|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.types.VCardType
ezvcard.types.TypeParameterType<T>
ezvcard.types.MultiValuedTypeParameterType<AddressTypeParameter>
ezvcard.types.LabelType
public class LabelType
Defines the exact text to put on the mailing label when mailing a package or letter to the person.
The LABEL type is not supported in 4.0. Instead, labels are included as a parameter to their corresponding ADR. When marshalling a vCard, EZ-vCard will use either the LABEL type or the LABEL parameter, depending on the requested vCard version.
To add a label to a vCard, the AddressType.setLabel(java.lang.String)
method should be
used.
VCard vcard = new VCard(); AddressType adr = new AddressType(); adr.setStreetAddress("123 Main St."); adr.setLocality("Austin"); adr.setRegion("TX"); adr.setPostalCode("12345"); adr.setLabel("123 Main St.\nAustin, TX 12345"); //newlines are allowed vcard.addAddress(adr);
The VCard.addOrphanedLabel(ezvcard.types.LabelType)
method adds a LABEL type to the vCard.
However, use of this method is discouraged because it creates a LABEL type
that's not associated with an address. Also, orphaned LABELs are ignored when
creating version 4.0 vCards because the LABEL type is not supported by vCard
4.0.
The VCard.getOrphanedLabels()
method can be used after parsing a
version 2.1 or 3.0 vCard to retrieve any LABEL types which the parser could
not assign to an address (ADR type). A LABEL is assigned to an ADR if the
LABEL's list of TYPE parameters is identical to the ADR's list of TYPE
parameters.
VCard vcard = ... for (LabelType label : vcard.getOrphanedLabels()) { System.out.println(label.getValue()); }
vCard property name: LABEL
vCard versions: 2.1, 3.0
Field Summary | |
---|---|
static String |
NAME
|
Fields inherited from class ezvcard.types.VCardType |
---|
group, subTypes, typeName |
Constructor Summary | |
---|---|
LabelType()
|
|
LabelType(String label)
|
Method Summary | |
---|---|
protected AddressTypeParameter |
buildTypeObj(String type)
Builds an object that wraps the value of the TYPE parameter. |
protected void |
doMarshalText(StringBuilder sb,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Converts this type object to a string for sending over the wire. |
protected void |
doUnmarshalHtml(HCardElement element,
List<String> warnings)
Unmarshals the type from an hCard (HTML document). |
protected void |
doUnmarshalText(String value,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Unmarshals the type value from off the wire. |
String |
getLanguage()
Gets the language the note is written in. |
VCardVersion[] |
getSupportedVersions()
Gets the vCard versions that support this type. |
String |
getValue()
Gets the label value. |
void |
setLanguage(String language)
Sets the language that the note is written in. |
void |
setValue(String value)
Sets the label value. |
Methods inherited from class ezvcard.types.MultiValuedTypeParameterType |
---|
addType, getTypes, removeType |
Methods inherited from class ezvcard.types.VCardType |
---|
compareTo, doMarshalSubTypes, doMarshalXml, doUnmarshalXml, getGroup, getQName, getSubTypes, getTypeName, marshalSubTypes, marshalText, marshalXml, setGroup, unmarshalHtml, unmarshalText, unmarshalXml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NAME
Constructor Detail |
---|
public LabelType()
public LabelType(String label)
label
- the label valueMethod Detail |
---|
protected AddressTypeParameter buildTypeObj(String type)
TypeParameterType
buildTypeObj
in class TypeParameterType<AddressTypeParameter>
type
- the value of the TYPE parameter
public String getValue()
public void setValue(String value)
value
- the label valuepublic String getLanguage()
VCardSubTypes.getLanguage()
public void setLanguage(String language)
language
- the language or null to removeVCardSubTypes.setLanguage(java.lang.String)
public VCardVersion[] getSupportedVersions()
VCardType
getSupportedVersions
in class VCardType
protected void doMarshalText(StringBuilder sb, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
VCardType
doMarshalText
in class VCardType
sb
- the buffer to add the marshalled value toversion
- the version vCard that is being generatedwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCardprotected void doUnmarshalText(String value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
VCardType
doUnmarshalText
in class VCardType
value
- the unfolded value from off the wire. If the wire value is
in the "quoted-printable" encoding, it will be decoded.version
- the version of the vCard that is being read or null if the
VERSION type has not been parsed yet (v3.0 and v4.0 require that the
VERSION type be at the top of the vCard, but v2.1 has no such
requirement)warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling processcompatibilityMode
- allows you to customize the unmarshalling
process depending on where the vCard came fromprotected void doUnmarshalHtml(HCardElement element, List<String> warnings)
VCardType
doUnmarshalHtml
in class VCardType
element
- the HTML element that contains the type data.warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling process
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |