biweekly.component.marshaller
Class ICalComponentMarshaller<T extends ICalComponent>

java.lang.Object
  extended by biweekly.component.marshaller.ICalComponentMarshaller<T>
Type Parameters:
T - the component class
Direct Known Subclasses:
DaylightSavingsTimeMarshaller, ICalendarMarshaller, RawComponentMarshaller, StandardTimeMarshaller, VAlarmMarshaller, VEventMarshaller, VFreeBusyMarshaller, VJournalMarshaller, VTimezoneMarshaller, VTodoMarshaller

public abstract class ICalComponentMarshaller<T extends ICalComponent>
extends Object

Base class for iCalendar component marshallers.

Author:
Michael Angstadt

Field Summary
protected  Class<T> clazz
           
protected  String componentName
           
 
Constructor Summary
ICalComponentMarshaller(Class<T> clazz, String componentName)
          Creates a new component marshaller.
 
Method Summary
protected abstract  T _newInstance()
          Creates a new instance of the component class.
 T emptyInstance()
          Creates a new instance of the component class that doesn't have any properties or sub-components.
 Class<T> getComponentClass()
          Gets the component class.
 String getComponentName()
          Gets the component's name.
 Collection<ICalComponent> getComponents(T component)
          Gets the sub-components to marshal.
 List<ICalProperty> getProperties(T component)
          Gets the properties to marshal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clazz

protected final Class<T extends ICalComponent> clazz

componentName

protected final String componentName
Constructor Detail

ICalComponentMarshaller

public ICalComponentMarshaller(Class<T> clazz,
                               String componentName)
Creates a new component marshaller.

Parameters:
clazz - the component's class
componentName - the component's name (e.g. "VEVENT")
Method Detail

getComponentClass

public Class<T> getComponentClass()
Gets the component class.

Returns:
the component class.

getComponentName

public String getComponentName()
Gets the component's name.

Returns:
the compent's name (e.g. "VEVENT")

emptyInstance

public T emptyInstance()
Creates a new instance of the component class that doesn't have any properties or sub-components.

Returns:
the new instance

_newInstance

protected abstract T _newInstance()
Creates a new instance of the component class.

Returns:
the new instance

getComponents

public Collection<ICalComponent> getComponents(T component)
Gets the sub-components to marshal. Child classes can override this for better control over which components are marshalled.

Parameters:
component - the component
Returns:
the sub-components to marshal

getProperties

public List<ICalProperty> getProperties(T component)
Gets the properties to marshal. Child classes can override this for better control over which properties are marshalled.

Parameters:
component - the component
Returns:
the properties to marshal


Copyright © 2013 Michael Angstadt. All Rights Reserved.