ezvcard.types
Class StructuredNameType

java.lang.Object
  extended by ezvcard.types.VCardType
      extended by ezvcard.types.StructuredNameType
All Implemented Interfaces:
Comparable<VCardType>

public class StructuredNameType
extends VCardType

Contains the separated components of the person's name.

Multiple instances of this type can be added ONLY if each instance has an ALTID parameter and the value of the ALTID parameter is the same across all instances. However, this is a border-case; under most circumstances, you will only need to add one instance.

 VCard vcard = new VCard();
 StructuredNameType n = new StructuredNameType();
 n.setFamily("House");
 n.setGiven("Gregory");
 n.addPrefix("Dr");
 n.addSuffix("MD");
 vcard.setStructuredName(n);
 

vCard property name: N

vCard versions: 2.1, 3.0, 4.0

Author:
Michael Angstadt

Field Summary
static String NAME
           
 
Fields inherited from class ezvcard.types.VCardType
group, subTypes, typeName
 
Constructor Summary
StructuredNameType()
           
 
Method Summary
 void addAdditional(String additional)
          Adds an additional name the person goes by.
 void addPrefix(String prefix)
          Adds a prefix.
 void addSuffix(String suffix)
          Adds a suffix.
protected  void doMarshalText(StringBuilder value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
          Converts this type object to a string for sending over the wire.
protected  void doMarshalXml(XCardElement parent, List<String> warnings, CompatibilityMode compatibilityMode)
          Marshals this type for inclusion in an xCard (XML document).
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.
protected  void doUnmarshalXml(XCardElement element, List<String> warnings, CompatibilityMode compatibilityMode)
          Unmarshals the type from an xCard (XML document).
 List<String> getAdditional()
          Gets any additional names the person goes by.
 String getAltId()
          Gets the ALTID.
 String getFamily()
          Gets the family name (aka "last name").
 String getGiven()
          Gets the given name (aka "first name").
 String getLanguage()
          Gets the language the name is written in.
 List<String> getPrefixes()
          Gets the prefixes.
 List<String> getSortAs()
          Gets the string(s) that define how to sort the vCard.
 List<String> getSuffixes()
          Gets the suffixes.
 void setAltId(String altId)
          Sets the ALTID.
 void setFamily(String family)
          Sets the family name (aka "last name").
 void setGiven(String given)
          Sets the given name (aka "first name").
 void setLanguage(String language)
          Sets the language the name is written in.
 void setSortAs(String family)
          Sets the string that defines how to sort the vCard.
 void setSortAs(String family, String given)
          Sets the strings that define how to sort the vCard.
 
Methods inherited from class ezvcard.types.VCardType
compareTo, doMarshalSubTypes, getGroup, getQName, getSubTypes, getSupportedVersions, 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

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

StructuredNameType

public StructuredNameType()
Method Detail

getFamily

public String getFamily()
Gets the family name (aka "last name").

Returns:
the family name or null if not set

setFamily

public void setFamily(String family)
Sets the family name (aka "last name").

Parameters:
family - the family name or null to remove

getGiven

public String getGiven()
Gets the given name (aka "first name").

Returns:
the given name or null if not set

setGiven

public void setGiven(String given)
Sets the given name (aka "first name").

Parameters:
given - the given name or null to remove

getAdditional

public List<String> getAdditional()
Gets any additional names the person goes by.

Returns:
the additional names or empty list if there are none

addAdditional

public void addAdditional(String additional)
Adds an additional name the person goes by.

Parameters:
additional - the additional name to add

getPrefixes

public List<String> getPrefixes()
Gets the prefixes.

Returns:
the prefixes (e.g. "Mr.") or empty list if there are none

addPrefix

public void addPrefix(String prefix)
Adds a prefix.

Parameters:
prefix - the prefix to add (e.g. "Mr.")

getSuffixes

public List<String> getSuffixes()
Gets the suffixes.

Returns:
the suffixes (e.g. "Jr.") or empty list if there are none

addSuffix

public void addSuffix(String suffix)
Adds a suffix.

Parameters:
suffix - the suffix to add (e.g. "Jr.")

getSortAs

public List<String> getSortAs()
Gets the string(s) that define how to sort the vCard.

2.1 and 3.0 vCards should use the SORT-STRING property instead.

vCard versions: 4.0

Returns:
the sort string(s) (e.g. ["Aboville", "Christine"] if the family name is "d'Aboville" and the given name is "Christine") or empty list if there are none
See Also:
VCardSubTypes.getSortAs()

setSortAs

public void setSortAs(String family)
Sets the string that defines how to sort the vCard.

2.1 and 3.0 vCards should use the SORT-STRING property instead.

vCard versions: 4.0

Parameters:
family - the sorttable family name (e.g. "Adboville" if the family name is "d'Aboville") or null to remove

setSortAs

public void setSortAs(String family,
                      String given)
Sets the strings that define how to sort the vCard.

2.1 and 3.0 vCards should use the SORT-STRING property instead.

vCard versions: 4.0

Parameters:
family - the sortable family name (e.g. "Adboville" if the family name is "d'Aboville")
given - the sortable given name

getLanguage

public String getLanguage()
Gets the language the name is written in.

Returns:
the language or null if not set
See Also:
VCardSubTypes.getLanguage()

setLanguage

public void setLanguage(String language)
Sets the language the name is written in.

Parameters:
language - the language or null to remove
See Also:
VCardSubTypes.setLanguage(java.lang.String)

getAltId

public String getAltId()
Gets the ALTID.

vCard versions: 4.0

Returns:
the ALTID or null if it doesn't exist
See Also:
VCardSubTypes.getAltId()

setAltId

public void setAltId(String altId)
Sets the ALTID.

vCard versions: 4.0

Parameters:
altId - the ALTID or null to remove
See Also:
VCardSubTypes.setAltId(java.lang.String)

doMarshalText

protected void doMarshalText(StringBuilder value,
                             VCardVersion version,
                             List<String> warnings,
                             CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Converts this type object to a string for sending over the wire. It is NOT responsible for folding.

Specified by:
doMarshalText in class VCardType
Parameters:
value - the buffer to add the marshalled value to
version - the version vCard that is being generated
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the marshalling process
compatibilityMode - allows the programmer to customize the marshalling process depending on the expected consumer of the vCard

doUnmarshalText

protected void doUnmarshalText(String value,
                               VCardVersion version,
                               List<String> warnings,
                               CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Unmarshals the type value from off the wire.

Specified by:
doUnmarshalText in class VCardType
Parameters:
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 process
compatibilityMode - allows you to customize the unmarshalling process depending on where the vCard came from

doMarshalXml

protected void doMarshalXml(XCardElement parent,
                            List<String> warnings,
                            CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Marshals this type for inclusion in an xCard (XML document). All child classes SHOULD override this, but are not required to.

Overrides:
doMarshalXml in class VCardType
Parameters:
parent - the XML element that the type's value will be inserted into. For example, this would be the "<fn>" element for the "FN" type.
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the marshalling process
compatibilityMode - allows the programmer to customize the marshalling process depending on the expected consumer of the vCard

doUnmarshalXml

protected void doUnmarshalXml(XCardElement element,
                              List<String> warnings,
                              CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Unmarshals the type from an xCard (XML document).

Overrides:
doUnmarshalXml in class VCardType
Parameters:
element - the XML element that contains the type data. For example, this would be the "<fn>" element for the "FN" type. This object will NOT include the "<parameters>" child element (it is removed after being unmarshalled into a VCardSubTypes object).
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the unmarshalling process
compatibilityMode - allows the programmer to customize the unmarshalling process depending on where the vCard came from

doUnmarshalHtml

protected void doUnmarshalHtml(HCardElement element,
                               List<String> warnings)
Description copied from class: VCardType
Unmarshals the type from an hCard (HTML document).

Overrides:
doUnmarshalHtml in class VCardType
Parameters:
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


Copyright © 2012-2013. All Rights Reserved.