public class CollectionConverter extends AbstractCollectionConverter
Supports java.util.ArrayList, java.util.HashSet, java.util.LinkedList, java.util.Vector and java.util.LinkedHashSet.
| Constructor and Description |
|---|
CollectionConverter(Mapper mapper) |
CollectionConverter(Mapper mapper,
java.lang.Class type)
Construct a CollectionConverter for a special Collection type.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCurrentElementToCollection(HierarchicalStreamReader reader,
UnmarshallingContext context,
java.util.Collection collection,
java.util.Collection target) |
boolean |
canConvert(java.lang.Class type)
Determines whether the converter can marshall a particular type.
|
protected java.lang.Object |
createCollection(java.lang.Class type) |
void |
marshal(java.lang.Object source,
HierarchicalStreamWriter writer,
MarshallingContext context)
Convert an object to textual data.
|
protected void |
populateCollection(HierarchicalStreamReader reader,
UnmarshallingContext context,
java.util.Collection collection) |
protected void |
populateCollection(HierarchicalStreamReader reader,
UnmarshallingContext context,
java.util.Collection collection,
java.util.Collection target) |
java.lang.Object |
unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context)
Convert textual data back into an object.
|
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItempublic CollectionConverter(Mapper mapper)
public CollectionConverter(Mapper mapper, java.lang.Class type)
mapper - the mappertype - the Collection type to handlepublic boolean canConvert(java.lang.Class type)
ConverterMatchercanConvert in interface ConverterMatchercanConvert in class AbstractCollectionConvertertype - the Class representing the object type to be convertedpublic void marshal(java.lang.Object source,
HierarchicalStreamWriter writer,
MarshallingContext context)
Convertermarshal in interface Convertermarshal in class AbstractCollectionConvertersource - The object to be marshalled.writer - A stream to write to.context - A context that allows nested objects to be processed by XStream.public java.lang.Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Converterunmarshal in interface Converterunmarshal in class AbstractCollectionConverterreader - The stream to read the text from.protected void populateCollection(HierarchicalStreamReader reader, UnmarshallingContext context, java.util.Collection collection)
protected void populateCollection(HierarchicalStreamReader reader, UnmarshallingContext context, java.util.Collection collection, java.util.Collection target)
protected void addCurrentElementToCollection(HierarchicalStreamReader reader, UnmarshallingContext context, java.util.Collection collection, java.util.Collection target)
protected java.lang.Object createCollection(java.lang.Class type)
createCollection in class AbstractCollectionConverterCopyright © 2004–2024 XStream. All rights reserved.