public class StructuredName extends VCardProperty implements HasAltId
Defines the individual components of the person's name.
Code sample
VCard vcard = new VCard(); StructuredName n = new StructuredName(); n.setFamily("House"); n.setGiven("Gregory"); n.getPrefixes().add("Dr"); n.getSuffixes().add("MD"); vcard.setStructuredName(n);
Property name: N
Supported versions: 2.1, 3.0, 4.0
group, parameters
Constructor and Description |
---|
StructuredName() |
StructuredName(StructuredName original)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_validate(List<ValidationWarning> warnings,
VCardVersion version,
VCard vcard)
Checks the property for data consistency problems or deviations from the
spec.
|
StructuredName |
copy()
Creates a copy of this property object.
|
boolean |
equals(Object obj) |
List<String> |
getAdditionalNames()
Gets the list that stores additional names the person goes by (for
example, a middle name).
|
String |
getAltId()
Gets the property's ALTID parameter.
|
String |
getFamily()
Gets the family name (aka "surname" or "last name").
|
String |
getGiven()
Gets the given name (aka "first name").
|
String |
getLanguage()
Gets the language that the property value is written in.
|
List<String> |
getPrefixes()
Gets the list that stores the person's honorific prefixes.
|
List<String> |
getSortAs()
Gets the list that holds string(s) which define how to sort the vCard.
|
List<String> |
getSuffixes()
Gets the list that stores the person's honorary suffixes.
|
int |
hashCode() |
void |
setAltId(String altId)
Sets the property's ALTID parameter.
|
void |
setFamily(String family)
Sets the family name (aka "surname" or "last name").
|
void |
setGiven(String given)
Sets the given name (aka "first name").
|
void |
setLanguage(String language)
Sets the language that the property value is written in.
|
void |
setSortAs(String family)
Defines a sortable version of the person's name.
|
void |
setSortAs(String family,
String given)
Defines a sortable version of the person's name.
|
protected Map<String,Object> |
toStringValues()
Gets string representations of the class's fields for the
VCardProperty.toString() method. |
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, isSupportedBy, removeParameter, setGroup, setParameter, setParameters, toString, validate
public StructuredName()
public StructuredName(StructuredName original)
original
- the property to make a copy ofpublic String getFamily()
public void setFamily(String family)
family
- the family name or null to removepublic String getGiven()
public void setGiven(String given)
given
- the given name or null to removepublic List<String> getAdditionalNames()
public List<String> getPrefixes()
public List<String> getSuffixes()
public List<String> getSortAs()
Gets the list that holds string(s) which define how to sort the vCard.
2.1 and 3.0 vCards should use the SortString
property instead.
Supported versions: 4.0
public void setSortAs(String family)
Defines a sortable version of the person's name.
2.1 and 3.0 vCards should use the SortString
property instead.
Supported versions: 4.0
family
- the sortable version of the family name (for example,
"Adboville" if the family name is "d'Aboville") or null to removepublic void setSortAs(String family, String given)
Defines a sortable version of the person's name.
2.1 and 3.0 vCards should use the SortString
property instead.
Supported versions: 4.0
family
- the sortable version of the family name (for example,
"Adboville" if the family name is "d'Aboville")given
- the sortable version of the given namepublic String getLanguage()
VCardProperty
public void setLanguage(String language)
VCardProperty
language
- the language or null to removepublic String getAltId()
HasAltId
Supported versions: 4.0
getAltId
in interface HasAltId
VCardParameters.getAltId()
public void setAltId(String altId)
HasAltId
Supported versions: 4.0
setAltId
in interface HasAltId
altId
- the ALTID or null to removeVCardParameters.setAltId(java.lang.String)
protected Map<String,Object> toStringValues()
VCardProperty
Gets string representations of the class's fields for the
VCardProperty.toString()
method.
Meant to be overridden by child classes. The default implementation returns an empty map.
toStringValues
in class VCardProperty
protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard)
VCardProperty
_validate
in class VCardProperty
warnings
- the list to add the warnings toversion
- the version to check the property againstvcard
- the vCard this property belongs topublic StructuredName 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
public int hashCode()
hashCode
in class VCardProperty
public boolean equals(Object obj)
equals
in class VCardProperty
Copyright © 2012–2023 Michael Angstadt. All rights reserved.