Top Description Fields Constructors Methods
com.thoughtworks.xstream.converters.collections

public Class SingletonMapConverter

extends MapConverter
Class Inheritance
Imports
java.util.Collections, com.thoughtworks.xstream.converters.UnmarshallingContext, com.thoughtworks.xstream.io.HierarchicalStreamReader, com.thoughtworks.xstream.mapper.Mapper

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.

Author
Jörg Schaible
Since
1.4.2

Field Summary

Modifier and TypeField and Description
private static final Class<T>

Constructor Summary

AccessConstructor and Description
public
SingletonMapConverter(Mapper mapper)

Construct a SingletonMapConverter.

Method Summary

Modifier and TypeMethod and Description
public boolean
canConvert(Class<T>
the Class representing the object type to be converted
type
)

Overrides com.thoughtworks.xstream.converters.collections.MapConverter.canConvert.

Implements com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Determines whether the converter can marshall a particular type.
public Object
unmarshal(HierarchicalStreamReader
The stream to read the text from.
reader
,
UnmarshallingContext context)

Overrides com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal.

Implements com.thoughtworks.xstream.converters.Converter.unmarshal.

Convert textual data back into an object.
Inherited from com.thoughtworks.xstream.converters.collections.MapConverter:
createCollectionmarshalpopulateMappopulateMapputCurrentEntryIntoMap

Field Detail

MAPback to summary
private static final Class<T> MAP

Constructor Detail

SingletonMapConverterback to summary
public SingletonMapConverter(Mapper mapper)

Construct a SingletonMapConverter.

Since
1.4.2

Method Detail

canConvertback to summary
public boolean canConvert(Class<T> type)

Overrides com.thoughtworks.xstream.converters.collections.MapConverter.canConvert.

Implements com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Doc from com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Determines whether the converter can marshall a particular type.

Parameters
type:Class<T>

the Class representing the object type to be converted

unmarshalback to summary
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)

Overrides com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal.

Implements com.thoughtworks.xstream.converters.Converter.unmarshal.

Doc from com.thoughtworks.xstream.converters.Converter.unmarshal.

Convert textual data back into an object.

Parameters
reader:HierarchicalStreamReader

The stream to read the text from.

Returns:Object

The resulting object.