|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiweekly.io.ICalMarshallerRegistrar
public class ICalMarshallerRegistrar
Manages a listing of component and property marshallers. This is useful for injecting the marshallers of any experimental components or properties you have defined into a reader or writer object. The same object instance can be reused and injected into multiple reader/writer classes.
Example:
//init the registrar
ICalMarshallerRegistrar registrar = new ICalMarshallerRegistrar();
registrar.register(new CustomPropertyMarshaller());
registrar.register(new AnotherCustomPropertyMarshaller());
registrar.register(new CustomComponentMarshaller());
//inject into a reader class
ICalReader textReader = new ICalReader(...);
textReader.setRegistrar(registrar);
List<ICalendar> icals = new ArrayList<ICalendar>();
ICalendar ical;
while ((ical = textReader.readNext()) != null){
icals.add(ical);
}
//inject the same instance in another reader/writer class
JCalWriter writer = new JCalWriter(...);
writer.setRegistrar(registrar);
for (ICalendar ical : icals){
writer.write(ical);
}
| Constructor Summary | |
|---|---|
ICalMarshallerRegistrar()
|
|
| Method Summary | |
|---|---|
ICalComponentMarshaller<? extends ICalComponent> |
getComponentMarshaller(Class<? extends ICalComponent> clazz)
Gets a component marshaller by class. |
ICalComponentMarshaller<? extends ICalComponent> |
getComponentMarshaller(ICalComponent component)
Gets the appropriate component marshaller for a given component instance. |
ICalComponentMarshaller<? extends ICalComponent> |
getComponentMarshaller(String componentName)
Gets a component marshaller by name. |
static ICalendarMarshaller |
getICalendarMarshaller()
Convenience method for getting the marshaller of the root iCalendar component ("VCALENDAR"). |
ICalPropertyMarshaller<? extends ICalProperty> |
getPropertyMarshaller(Class<? extends ICalProperty> clazz)
Gets a property marshaller by class. |
ICalPropertyMarshaller<? extends ICalProperty> |
getPropertyMarshaller(ICalProperty property)
Gets the appropriate property marshaller for a given property instance. |
ICalPropertyMarshaller<? extends ICalProperty> |
getPropertyMarshaller(QName qname)
Gets a property marshaller by XML local name and namespace. |
ICalPropertyMarshaller<? extends ICalProperty> |
getPropertyMarshaller(String propertyName)
Gets a property marshaller by name. |
void |
register(ICalComponentMarshaller<? extends ICalComponent> marshaller)
Registers a component marshaller. |
void |
register(ICalPropertyMarshaller<? extends ICalProperty> marshaller)
Registers a property marshaller. |
void |
unregister(ICalComponentMarshaller<? extends ICalComponent> marshaller)
Unregisters a component marshaller. |
void |
unregister(ICalPropertyMarshaller<? extends ICalProperty> marshaller)
Unregisters a property marshaller |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ICalMarshallerRegistrar()
| Method Detail |
|---|
public ICalComponentMarshaller<? extends ICalComponent> getComponentMarshaller(String componentName)
componentName - the component name (e.g. "VEVENT")
RawComponentMarshaller if
not foundpublic ICalPropertyMarshaller<? extends ICalProperty> getPropertyMarshaller(String propertyName)
propertyName - the property name (e.g. "VERSION")
RawPropertyMarshaller if not
foundpublic ICalComponentMarshaller<? extends ICalComponent> getComponentMarshaller(Class<? extends ICalComponent> clazz)
clazz - the component class
public ICalPropertyMarshaller<? extends ICalProperty> getPropertyMarshaller(Class<? extends ICalProperty> clazz)
clazz - the property class
public ICalComponentMarshaller<? extends ICalComponent> getComponentMarshaller(ICalComponent component)
component - the component instance
public ICalPropertyMarshaller<? extends ICalProperty> getPropertyMarshaller(ICalProperty property)
property - the property instance
public ICalPropertyMarshaller<? extends ICalProperty> getPropertyMarshaller(QName qname)
qname - the XML local name and namespace
XmlMarshaller if not foundpublic void register(ICalComponentMarshaller<? extends ICalComponent> marshaller)
marshaller - the marshaller to registerpublic void register(ICalPropertyMarshaller<? extends ICalProperty> marshaller)
marshaller - the marshaller to registerpublic void unregister(ICalComponentMarshaller<? extends ICalComponent> marshaller)
marshaller - the marshaller to unregisterpublic void unregister(ICalPropertyMarshaller<? extends ICalProperty> marshaller)
marshaller - the marshaller to unregisterpublic static ICalendarMarshaller getICalendarMarshaller()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||