Class TreeMapConverter
java.lang.Object
com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
com.thoughtworks.xstream.converters.collections.MapConverter
com.thoughtworks.xstream.converters.collections.TreeMapConverter
- All Implemented Interfaces:
Converter
,ConverterMatcher
Converts a java.util.TreeMap to XML, and serializes
the associated java.util.Comparator. The converter
assumes that the entries in the XML are already sorted
according the comparator.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
marshal
(Object source, HierarchicalStreamWriter writer, MarshallingContext context) Convert an object to textual data.protected void
marshalComparator
(Comparator comparator, HierarchicalStreamWriter writer, MarshallingContext context) protected void
populateTreeMap
(HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result, Comparator comparator) unmarshal
(HierarchicalStreamReader reader, UnmarshallingContext context) Convert textual data back into an object.protected Comparator
unmarshalComparator
(HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result) Methods inherited from class com.thoughtworks.xstream.converters.collections.MapConverter
canConvert, createCollection, populateMap, populateMap, putCurrentEntryIntoMap
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItem
-
Field Details
-
NULL_MARKER
-
-
Constructor Details
-
TreeMapConverter
-
-
Method Details
-
marshal
Description copied from interface:Converter
Convert an object to textual data.- Specified by:
marshal
in interfaceConverter
- Overrides:
marshal
in classMapConverter
- 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.
-
marshalComparator
protected void marshalComparator(Comparator comparator, HierarchicalStreamWriter writer, MarshallingContext context) -
unmarshal
Description copied from interface:Converter
Convert textual data back into an object.- Specified by:
unmarshal
in interfaceConverter
- Overrides:
unmarshal
in classMapConverter
- Parameters:
reader
- The stream to read the text from.context
-- Returns:
- The resulting object.
-
unmarshalComparator
protected Comparator unmarshalComparator(HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result) -
populateTreeMap
protected void populateTreeMap(HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result, Comparator comparator)
-