ezvcard.io.scribe
Class AgentScribe

java.lang.Object
  extended by ezvcard.io.scribe.VCardPropertyScribe<Agent>
      extended by ezvcard.io.scribe.AgentScribe

public class AgentScribe
extends VCardPropertyScribe<Agent>

Marshals Agent properties.

Author:
Michael Angstadt

Nested Class Summary
 
Nested classes/interfaces inherited from class ezvcard.io.scribe.VCardPropertyScribe
VCardPropertyScribe.DateWriter, VCardPropertyScribe.Result<T extends VCardProperty>, VCardPropertyScribe.SemiStructuredIterator, VCardPropertyScribe.Splitter, VCardPropertyScribe.StructuredIterator
 
Field Summary
 
Fields inherited from class ezvcard.io.scribe.VCardPropertyScribe
clazz, propertyName, qname
 
Constructor Summary
AgentScribe()
           
 
Method Summary
protected  VCardDataType _dataType(Agent property, VCardVersion version)
           Determines the data type of a property instance.
protected  VCardDataType _defaultDataType(VCardVersion version)
           Determines the property's default data type.
protected  Agent _parseHtml(HCardElement element, List<String> warnings)
           Unmarshals the property from an hCard (HTML document).
protected  Agent _parseText(String value, VCardDataType dataType, VCardVersion version, VCardParameters parameters, List<String> warnings)
          Unmarshals a property from a plain-text vCard.
protected  String _writeText(Agent property, VCardVersion version)
          Marshals a property's value to a string.
 
Methods inherited from class ezvcard.io.scribe.VCardPropertyScribe
_parseJson, _parseXml, _prepareParameters, _writeJson, _writeXml, dataType, date, date, defaultDataType, escape, getPropertyClass, getPropertyName, getQName, handlePrefParam, list, list, list, missingXmlElements, missingXmlElements, parseHtml, parseJson, parseText, parseXml, prepareParameters, semistructured, semistructured, split, structured, structured, structured, unescape, writeJson, writeText, writeXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentScribe

public AgentScribe()
Method Detail

_defaultDataType

protected VCardDataType _defaultDataType(VCardVersion version)
Description copied from class: VCardPropertyScribe

Determines the property's default data type.

When writing a plain-text vCard, if the data type of a property instance (as determined by the VCardPropertyScribe.dataType(T, ezvcard.VCardVersion) method) matches the default data type, then a VALUE parameter will *not* be written.

When parsing a plain-text vCard, if a property has no VALUE parameter, then the property's default data type will be passed into the VCardPropertyScribe.parseText(java.lang.String, ezvcard.VCardDataType, ezvcard.VCardVersion, ezvcard.parameter.VCardParameters) method.

Specified by:
_defaultDataType in class VCardPropertyScribe<Agent>
Parameters:
version - the vCard version
Returns:
the default data type or null if unknown

_dataType

protected VCardDataType _dataType(Agent property,
                                  VCardVersion version)
Description copied from class: VCardPropertyScribe

Determines the data type of a property instance.

This method should be overridden by child classes if a property's data type changes depending on its value. The default implementation of this method calls VCardPropertyScribe._defaultDataType(ezvcard.VCardVersion).

Overrides:
_dataType in class VCardPropertyScribe<Agent>
Parameters:
property - the property
version - the version of the vCard that is being generated
Returns:
the data type or null if unknown

_writeText

protected String _writeText(Agent property,
                            VCardVersion version)
Description copied from class: VCardPropertyScribe
Marshals a property's value to a string.

Specified by:
_writeText in class VCardPropertyScribe<Agent>
Parameters:
property - the property
version - the version of the vCard that is being generated
Returns:
the marshalled value

_parseText

protected Agent _parseText(String value,
                           VCardDataType dataType,
                           VCardVersion version,
                           VCardParameters parameters,
                           List<String> warnings)
Description copied from class: VCardPropertyScribe
Unmarshals a property from a plain-text vCard.

Specified by:
_parseText in class VCardPropertyScribe<Agent>
Parameters:
value - the value as read off the wire
dataType - the data type of the property value. The property's VALUE parameter is used to determine the data type. If the property has no VALUE parameter, then this parameter will be set to the property's default datatype, as determined by the VCardPropertyScribe.defaultDataType(ezvcard.VCardVersion) method. Note that the VALUE parameter is removed from the property's parameter list after it has been read.
version - the version of the vCard that is being parsed
parameters - the parsed parameters. These parameters will be assigned to the property object once this method returns. Therefore, do not assign any parameters to the property object itself whilst inside of this method, or else they will be overwritten.
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the unmarshalling process
Returns:
the unmarshalled property object

_parseHtml

protected Agent _parseHtml(HCardElement element,
                           List<String> warnings)
Description copied from class: VCardPropertyScribe

Unmarshals the property from an hCard (HTML document).

This method should be overridden by child classes that wish to support hCard. The default implementation of this method will retrieve the HTML element's hCard value (as described in HCardElement.value()), and pass it into the VCardPropertyScribe._parseText(java.lang.String, ezvcard.VCardDataType, ezvcard.VCardVersion, ezvcard.parameter.VCardParameters, java.util.List) method.

Overrides:
_parseHtml in class VCardPropertyScribe<Agent>
Parameters:
element - the property's HTML element
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 Michael Angstadt. All Rights Reserved.