biweekly.property.marshaller
Class ExceptionDatesMarshaller

java.lang.Object
  extended by biweekly.property.marshaller.ICalPropertyMarshaller<T>
      extended by biweekly.property.marshaller.ListPropertyMarshaller<ExceptionDates,Date>
          extended by biweekly.property.marshaller.ExceptionDatesMarshaller

public class ExceptionDatesMarshaller
extends ListPropertyMarshaller<ExceptionDates,Date>

Marshals ExceptionDates properties.

Author:
Michael Angstadt

Nested Class Summary
 
Nested classes/interfaces inherited from class biweekly.property.marshaller.ICalPropertyMarshaller
ICalPropertyMarshaller.DateParser, ICalPropertyMarshaller.DateWriter, ICalPropertyMarshaller.ListCallback<T>, ICalPropertyMarshaller.Result<T extends ICalProperty>, ICalPropertyMarshaller.SemiStructuredIterator, ICalPropertyMarshaller.Splitter, ICalPropertyMarshaller.StructuredIterator
 
Field Summary
 
Fields inherited from class biweekly.property.marshaller.ICalPropertyMarshaller
clazz, defaultDataType, propertyName, qname
 
Constructor Summary
ExceptionDatesMarshaller()
           
 
Method Summary
protected  ICalDataType _dataType(ExceptionDates property)
           Determines the data type of a property instance.
protected  ExceptionDates _parseJson(JCalValue value, ICalDataType dataType, ICalParameters parameters, List<String> warnings)
          /**
protected  ExceptionDates _parseXml(XCalElement element, ICalParameters parameters, List<String> warnings)
           Unmarshals a property from an XML document (xCal).
protected  JCalValue _writeJson(ExceptionDates property)
           Marshals a property's value to a JSON data stream (jCal).
protected  void _writeXml(ExceptionDates property, XCalElement element)
           Marshals a property's value to an XML element (xCal).
protected  ExceptionDates newInstance(ICalDataType dataType, ICalParameters parameters)
           
protected  Date readValue(String value, ICalDataType dataType, ICalParameters parameters, List<String> warnings)
           
protected  String writeValue(ExceptionDates property, Date value)
           
 
Methods inherited from class biweekly.property.marshaller.ListPropertyMarshaller
_parseText, _writeText
 
Methods inherited from class biweekly.property.marshaller.ICalPropertyMarshaller
_prepareParameters, dataType, date, date, escape, getDefaultDataType, getPropertyClass, getPropertyName, getQName, list, list, list, list, missingXmlElements, missingXmlElements, object, object, 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

ExceptionDatesMarshaller

public ExceptionDatesMarshaller()
Method Detail

_dataType

protected ICalDataType _dataType(ExceptionDates property)
Description copied from class: ICalPropertyMarshaller

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 returns the property's default data type.

Overrides:
_dataType in class ICalPropertyMarshaller<ExceptionDates>
Parameters:
property - the property
Returns:
the data type or null if unknown

newInstance

protected ExceptionDates newInstance(ICalDataType dataType,
                                     ICalParameters parameters)
Specified by:
newInstance in class ListPropertyMarshaller<ExceptionDates,Date>

writeValue

protected String writeValue(ExceptionDates property,
                            Date value)
Specified by:
writeValue in class ListPropertyMarshaller<ExceptionDates,Date>

readValue

protected Date readValue(String value,
                         ICalDataType dataType,
                         ICalParameters parameters,
                         List<String> warnings)
Specified by:
readValue in class ListPropertyMarshaller<ExceptionDates,Date>

_writeXml

protected void _writeXml(ExceptionDates property,
                         XCalElement element)
Description copied from class: ICalPropertyMarshaller

Marshals a property's value to an XML element (xCal).

This method should be overridden by child classes that wish to support xCal. The default implementation of this method will append one child element to the property's XML element. The child element's name will be that of the property's data type (retrieved using the ICalPropertyMarshaller.dataType(T) method), and the child element's text content will be set to the property's marshalled plain-text value (retrieved using the ICalPropertyMarshaller.writeText(T) method).

Overrides:
_writeXml in class ListPropertyMarshaller<ExceptionDates,Date>
Parameters:
property - the property
element - the property's XML element

_parseXml

protected ExceptionDates _parseXml(XCalElement element,
                                   ICalParameters parameters,
                                   List<String> warnings)
Description copied from class: ICalPropertyMarshaller

Unmarshals a property from an XML document (xCal).

This method should be overridden by child classes that wish to support xCal. The default implementation of this method will find the first child element with the xCal namespace. The element's name will be used as the property's data type and its text content will be passed into the ICalPropertyMarshaller._parseText(java.lang.String, biweekly.ICalDataType, biweekly.parameter.ICalParameters, java.util.List) method. If no such child element is found, then the parent element's text content will be passed into ICalPropertyMarshaller._parseText(java.lang.String, biweekly.ICalDataType, biweekly.parameter.ICalParameters, java.util.List) and the data type will be null.

Overrides:
_parseXml in class ListPropertyMarshaller<ExceptionDates,Date>
Parameters:
element - the property's XML element
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

_writeJson

protected JCalValue _writeJson(ExceptionDates property)
Description copied from class: ICalPropertyMarshaller

Marshals a property's value to a JSON data stream (jCal).

This method should be overridden by child classes that wish to support jCal. The default implementation of this method will create a jCard property that has a single JSON string value (generated by the ICalPropertyMarshaller.writeText(T) method).

Overrides:
_writeJson in class ListPropertyMarshaller<ExceptionDates,Date>
Parameters:
property - the property
Returns:
the marshalled value

_parseJson

protected ExceptionDates _parseJson(JCalValue value,
                                    ICalDataType dataType,
                                    ICalParameters parameters,
                                    List<String> warnings)
Description copied from class: ICalPropertyMarshaller
/**

Unmarshals a property from a JSON data stream (jCal).

This method should be overridden by child classes that wish to support jCal. The default implementation of this method will convert the jCal property value to a string and pass it into the ICalPropertyMarshaller._parseText(java.lang.String, biweekly.ICalDataType, biweekly.parameter.ICalParameters, java.util.List) method.


The following paragraphs describe the way in which this method's default implementation converts a jCal value to a string:

If the jCal value consists of a single, non-array, non-object value, then the value is converted to a string. Special characters (backslashes, commas, and semicolons) are escaped in order to simulate what the value might look like in a plain-text iCalendar object.
["x-foo", {}, "text", "the;value"] --> "the\;value"
["x-foo", {}, "text", 2] --> "2"

If the jCal value consists of multiple, non-array, non-object values, then all the values are appended together in a single string, separated by commas. Special characters (backslashes, commas, and semicolons) are escaped for each value in order to prevent commas from being treated as delimiters, and to simulate what the value might look like in a plain-text iCalendar object.
["x-foo", {}, "text", "one", "two,three"] --> "one,two\,three"

If the jCal value is a single array, then this array is treated as a "structured value", and converted its plain-text representation. Special characters (backslashes, commas, and semicolons) are escaped for each value in order to prevent commas and semicolons from being treated as delimiters.
["x-foo", {}, "text", ["one", ["two", "three"], "four;five"]] --> "one;two,three;four\;five"

If the jCal value starts with a JSON object, then the object is converted to a format identical to the one used in the RRULE and EXRULE properties. Special characters (backslashes, commas, semicolons, and equal signs) are escaped for each value in order to preserve the syntax of the string value.
["x-foo", {}, "text", {"one": 1, "two": [2, 2.5]}] --> "ONE=1;TWO=2,2.5"

For all other cases, behavior is undefined.

Overrides:
_parseJson in class ListPropertyMarshaller<ExceptionDates,Date>
Parameters:
value - the property's JSON value
dataType - the data type
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


Copyright © 2013 Michael Angstadt. All Rights Reserved.