@SupportedVersions(value={V2_1,V3_0}) public class Label extends TextProperty
Defines the exact text to put on the mailing label when sending snail mail to
the person. Note that instances of this class should NEVER be added to a
vCard! Instead, use the Address.setLabel(java.lang.String)
method to assign a mailing
label to an Address
property.
Version interoperability
The label property is not supported in vCard version 4.0. Instead, labels are
included as parameters to their corresponding Address
properties. When marshalling a vCard, ez-vcard will use either the label
property or the LABEL parameter, depending on the requested vCard version.
Orphaned labels
ez-vcard defines an "orphaned label" as a label property that could not be
assigned to an address (a label is assigned to an address if its list of TYPE
parameters is identical to the address's list of TYPE parameters). The
VCard.addOrphanedLabel(ezvcard.property.Label)
method can be used to add such labels to a
vCard, but its use is strongly discouraged. The
VCard.getOrphanedLabels()
method can be useful when parsing version 2.1
or 3.0 vCards in order to retrieve any label properties that the parser could
not assign to an address.
Property name: LABEL
Supported versions: 2.1, 3.0
value
group, parameters
Constructor and Description |
---|
Label(Label original)
Copy constructor.
|
Label(String label)
Creates a label property.
|
Modifier and Type | Method and Description |
---|---|
Label |
copy()
Creates a copy of this property object.
|
String |
getLanguage()
Gets the language that the property value is written in.
|
List<AddressType> |
getTypes()
Gets the list that stores this property's address types (TYPE
parameters).
|
void |
setLanguage(String language)
Sets the language that the property value is written in.
|
_validate, equals, getValue, hashCode, setValue, toStringValues
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, isSupportedBy, removeParameter, setGroup, setParameter, setParameters, toString, validate
public List<AddressType> getTypes()
public String getLanguage()
VCardProperty
public void setLanguage(String language)
VCardProperty
language
- the language or null to removepublic Label copy()
VCardProperty
Creates a copy of this property object.
The default implementation of this method uses reflection to look for a copy constructor. Child classes SHOULD override this method to avoid the performance overhead involved in using reflection.
The child class's copy constructor, if present, MUST invoke the
VCardProperty.VCardProperty(VCardProperty)
super constructor to ensure that
the group name and parameters are also copied.
This method MUST be overridden by the child class if the child class does
not have a copy constructor. Otherwise, an
UnsupportedOperationException
will be thrown when an attempt is
made to copy the property (such as in the VCard
class's copy constructor
).
copy
in class VCardProperty
Copyright © 2012–2023 Michael Angstadt. All rights reserved.