|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.property.VCardProperty
ezvcard.property.SimpleProperty<String>
ezvcard.property.TextProperty
ezvcard.property.Label
public class Label
Defines the exact text to put on the mailing label when mailing a package or letter to the person.
The LABEL property is not supported in 4.0. Instead, labels are included as a
parameter to their corresponding Address
. When marshalling a vCard,
ez-vcard will use either the LABEL property or the LABEL parameter, depending
on the requested vCard version.
To add a label to a vCard, the Address.setLabel(java.lang.String)
method should be
used.
VCard vcard = new VCard(); Address adr = new Address(); 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.property.Label)
method adds a LABEL property to the vCard.
However, use of this method is discouraged because it creates a LABEL
property that's not associated with an address. Also, orphaned LABEL
properties are ignored when creating version 4.0 vCards because the LABEL
property 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 properties which the parser
could not assign to an address. A LABEL is assigned to an address if the
LABEL's list of TYPE parameters is identical to the address's list of TYPE
parameters.
VCard vcard = ... for (Label label : vcard.getOrphanedLabels()) { System.out.println(label.getValue()); }
Property name: LABEL
Supported versions: 2.1, 3.0
Field Summary |
---|
Fields inherited from class ezvcard.property.SimpleProperty |
---|
value |
Fields inherited from class ezvcard.property.VCardProperty |
---|
group, parameters |
Constructor Summary | |
---|---|
Label(String label)
Creates a label property. |
Method Summary | |
---|---|
Set<VCardVersion> |
_supportedVersions()
Gets the vCard versions that support this property. |
void |
addType(AddressType type)
Adds a TYPE parameter. |
String |
getLanguage()
Gets the language that the property value is written in. |
Set<AddressType> |
getTypes()
Gets all the TYPE parameters. |
void |
removeType(AddressType type)
Removes a TYPE parameter. |
void |
setLanguage(String language)
Sets the language that the property value is written in. |
Methods inherited from class ezvcard.property.SimpleProperty |
---|
_validate, getValue, setValue |
Methods inherited from class ezvcard.property.VCardProperty |
---|
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Label(String label)
label
- the label valueMethod Detail |
---|
public Set<VCardVersion> _supportedVersions()
VCardProperty
Gets the vCard versions that support this property.
This method should be overridden by child classes if the property does not support all vCard versions. The default implementation of this method returns all vCard versions.
_supportedVersions
in class VCardProperty
public Set<AddressType> getTypes()
public void addType(AddressType type)
type
- the TYPE parameter to addpublic void removeType(AddressType type)
type
- the TYPE parameter to removepublic String getLanguage()
VCardProperty
VCardParameters.getLanguage()
public void setLanguage(String language)
VCardProperty
language
- the language or null to removeVCardParameters.setLanguage(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |