Class SingletonMapConverter
- java.lang.Object
-
- com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
-
- com.thoughtworks.xstream.converters.collections.MapConverter
-
- com.thoughtworks.xstream.converters.collections.SingletonMapConverter
-
- All Implemented Interfaces:
Converter
,ConverterMatcher
public class SingletonMapConverter extends MapConverter
Converts a singleton map to XML, specifying an 'entry' element with 'key' and 'value' children.Note: 'key' and 'value' is not the name of the generated tag. The children are serialized as normal elements and the implementation expects them in the order 'key'/'value'.
Supports Collections.singletonMap.
- Since:
- 1.4.2
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Class
MAP
-
Constructor Summary
Constructors Constructor Description SingletonMapConverter(Mapper mapper)
Construct a SingletonMapConverter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConvert(java.lang.Class type)
Determines whether the converter can marshall a particular type.java.lang.Object
unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Convert textual data back into an object.-
Methods inherited from class com.thoughtworks.xstream.converters.collections.MapConverter
createCollection, marshal, populateMap, populateMap, putCurrentEntryIntoMap
-
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItem
-
-
-
-
Constructor Detail
-
SingletonMapConverter
public SingletonMapConverter(Mapper mapper)
Construct a SingletonMapConverter.- Parameters:
mapper
-- Since:
- 1.4.2
-
-
Method Detail
-
canConvert
public boolean canConvert(java.lang.Class type)
Description copied from interface:ConverterMatcher
Determines whether the converter can marshall a particular type.- Specified by:
canConvert
in interfaceConverterMatcher
- Overrides:
canConvert
in classMapConverter
- Parameters:
type
- the Class representing the object type to be converted
-
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 classMapConverter
- Parameters:
reader
- The stream to read the text from.- Returns:
- The resulting object.
-
-