public abstract class AbstractCollectionConverter extends Object implements Converter
Typically, subclasses of this will converter the outer structure of the collection, loop through the contents and call readItem() or writeItem() for each item.
Constructor and Description |
---|
AbstractCollectionConverter(Mapper mapper) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
canConvert(Class type)
Determines whether the converter can marshall a particular type.
|
protected Object |
createCollection(Class type) |
protected Mapper |
mapper() |
abstract void |
marshal(Object source,
HierarchicalStreamWriter writer,
MarshallingContext context)
Convert an object to textual data.
|
protected Object |
readItem(HierarchicalStreamReader reader,
UnmarshallingContext context,
Object current) |
abstract Object |
unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context)
Convert textual data back into an object.
|
protected void |
writeItem(Object item,
MarshallingContext context,
HierarchicalStreamWriter writer) |
public AbstractCollectionConverter(Mapper mapper)
public abstract boolean canConvert(Class type)
ConverterMatcher
canConvert
in interface ConverterMatcher
type
- the Class representing the object type to be convertedprotected Mapper mapper()
public abstract void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Converter
public abstract Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Converter
protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer)
protected Object readItem(HierarchicalStreamReader reader, UnmarshallingContext context, Object current)
Copyright © 2004–2016 XStream. All rights reserved.