ezvcard.types
Class AgentType

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

public class AgentType
extends VCardType

An embedded vCard or URL containing the information of someone who represents the person.

 //URL
 VCard vcard = new VCard();
 AgentType agent = new AgentType("http://mi5.gov.uk/007");
 vcard.setAgent(agent);
 
 //vCard
 VCard vcard = new VCard();
 VCard agentVcard = new VCard();
 agentVcard.setFormattedName(new FormattedNameType("Agent 007"));
 AgentType agent = new AgentType(agentVcard);
 vcard.setAgent(agent);
 

vCard property name: AGENT

vCard versions: 2.1, 3.0

Author:
Michael Angstadt

Field Summary
static String NAME
           
 
Fields inherited from class ezvcard.types.VCardType
group, subTypes, typeName
 
Constructor Summary
AgentType()
           
AgentType(String url)
           
AgentType(VCard vcard)
           
 
Method Summary
protected  void doMarshalSubTypes(VCardSubTypes copy, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode, VCard vcard)
          Gets the sub types that will be sent over the wire.
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.
 VCardVersion[] getSupportedVersions()
          Gets the vCard versions that support this type.
 String getUrl()
          Gets the URL to the agent's information.
 VCard getVCard()
          Gets an embedded vCard with the agent's information.
 void setUrl(String url)
          Sets the URL to the agent's information.
 void setVCard(VCard vcard)
          Sets an embedded vCard with the agent's information.
 
Methods inherited from class ezvcard.types.VCardType
compareTo, 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

NAME

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

AgentType

public AgentType()

AgentType

public AgentType(String url)
Parameters:
url - a URL pointing to the agent's information

AgentType

public AgentType(VCard vcard)
Parameters:
vcard - a vCard containing the agent's information
Method Detail

getUrl

public String getUrl()
Gets the URL to the agent's information.

Returns:
the URL or null if not set

setUrl

public void setUrl(String url)
Sets the URL to the agent's information.

Parameters:
url - the URL

getVCard

public VCard getVCard()
Gets an embedded vCard with the agent's information.

Returns:
the vCard or null if not set

setVCard

public void setVCard(VCard vcard)
Sets an embedded vCard with the agent's information.

Parameters:
vcard - the vCard

getSupportedVersions

public VCardVersion[] getSupportedVersions()
Description copied from class: VCardType
Gets the vCard versions that support this type.

Overrides:
getSupportedVersions in class VCardType
Returns:
the vCard versions that support this type.

doMarshalSubTypes

protected void doMarshalSubTypes(VCardSubTypes copy,
                                 VCardVersion version,
                                 List<String> warnings,
                                 CompatibilityMode compatibilityMode,
                                 VCard vcard)
Description copied from class: VCardType
Gets the sub types that will be sent over the wire.

If this method is NOT overridden, then the type's sub types will be sent over the wire as-is. In other words, whatever is in the VCardType.subTypes field will be sent. Child classes can override this method in order to modify the sub types before they are marshalled.

Overrides:
doMarshalSubTypes in class VCardType
Parameters:
copy - the sub types that will be marshalled into the vCard. This object is a copy of the VCardType.subTypes field, so any modifications done to this object will not effect the state of the field.
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
vcard - the VCard object that is being marshalled

doMarshalText

protected void doMarshalText(StringBuilder sb,
                             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:
sb - 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

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.