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 classprivate static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidmarshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) Convert an object to textual data.protected voidmarshalComparator(Comparator comparator, HierarchicalStreamWriter writer, MarshallingContext context) protected voidpopulateTreeMap(HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result, Comparator comparator) unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) Convert textual data back into an object.protected ComparatorunmarshalComparator(HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result) Methods inherited from class MapConverter
canConvert, createCollection, populateMap, populateMap, putCurrentEntryIntoMapMethods inherited from class AbstractCollectionConverter
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItem
-
Field Details
-
NULL_MARKER
-
-
Constructor Details
-
TreeMapConverter
-
-
Method Details
-
marshal
Description copied from interface:ConverterConvert an object to textual data.- Specified by:
marshalin interfaceConverter- Overrides:
marshalin 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:ConverterConvert textual data back into an object.- Specified by:
unmarshalin interfaceConverter- Overrides:
unmarshalin 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)
-