|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
com.thoughtworks.xstream.converters.collections.CollectionConverter
public class CollectionConverter
Converts most common Collections (Lists and Sets) to XML, specifying a nested element for each item.
Supports java.util.ArrayList, java.util.HashSet, java.util.LinkedList, java.util.Vector and java.util.LinkedHashSet.
Constructor Summary | |
---|---|
CollectionConverter(Mapper mapper)
|
Method Summary | |
---|---|
boolean |
canConvert(java.lang.Class type)
Determines whether the converter can marshall a particular 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)
|
java.lang.Object |
unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context)
Convert textual data back into an object. |
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter |
---|
createCollection, mapper, readItem, writeItem |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionConverter(Mapper mapper)
Method Detail |
---|
public boolean canConvert(java.lang.Class type)
ConverterMatcher
canConvert
in interface ConverterMatcher
canConvert
in class AbstractCollectionConverter
type
- the Class representing the object type to be convertedpublic void marshal(java.lang.Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Converter
marshal
in interface Converter
marshal
in class AbstractCollectionConverter
source
- 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)
Converter
unmarshal
in interface Converter
unmarshal
in class AbstractCollectionConverter
reader
- The stream to read the text from.
protected void populateCollection(HierarchicalStreamReader reader, UnmarshallingContext context, java.util.Collection collection)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |