Class TreeSetConverter
- java.lang.Object
-
- com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
-
- com.thoughtworks.xstream.converters.collections.CollectionConverter
-
- com.thoughtworks.xstream.converters.collections.TreeSetConverter
-
- All Implemented Interfaces:
Converter
,ConverterMatcher
public class TreeSetConverter extends CollectionConverter
Converts a java.util.TreeSet to XML, and serializes the associated java.util.Comparator. The converter assumes that the elements in the XML are already sorted according the comparator.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Object
constantValue
private static java.lang.reflect.Field
sortedMapField
private TreeMapConverter
treeMapConverter
-
Constructor Summary
Constructors Constructor Description TreeSetConverter(Mapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
marshal(java.lang.Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Convert an object to textual data.private java.lang.Object
readResolve()
java.lang.Object
unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Convert textual data back into an object.-
Methods inherited from class com.thoughtworks.xstream.converters.collections.CollectionConverter
addCurrentElementToCollection, canConvert, createCollection, populateCollection, populateCollection
-
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItem
-
-
-
-
Field Detail
-
treeMapConverter
private transient TreeMapConverter treeMapConverter
-
sortedMapField
private static final java.lang.reflect.Field sortedMapField
-
constantValue
private static final java.lang.Object constantValue
-
-
Constructor Detail
-
TreeSetConverter
public TreeSetConverter(Mapper mapper)
-
-
Method Detail
-
marshal
public void marshal(java.lang.Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Description copied from interface:Converter
Convert an object to textual data.- Specified by:
marshal
in interfaceConverter
- Overrides:
marshal
in classCollectionConverter
- Parameters:
source
- The object to be marshalled.writer
- A stream to write to.context
- A context that allows nested objects to be processed by XStream.
-
unmarshal
public java.lang.Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Description copied from interface:Converter
Convert textual data back into an object.- Specified by:
unmarshal
in interfaceConverter
- Overrides:
unmarshal
in classCollectionConverter
- Parameters:
reader
- The stream to read the text from.- Returns:
- The resulting object.
-
readResolve
private java.lang.Object readResolve()
-
-