com.thoughtworks.xstream.converters.collections
Class SingletonMapConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
      extended by com.thoughtworks.xstream.converters.collections.MapConverter
          extended by 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
Author:
Jörg Schaible

Constructor Summary
SingletonMapConverter(Mapper mapper)
          Construct a SingletonMapConverter.
 
Method Summary
 boolean canConvert(Class type)
          Determines whether the converter can marshall a particular type.
 Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
          Convert textual data back into an object.
 
Methods inherited from class com.thoughtworks.xstream.converters.collections.MapConverter
marshal, populateMap, populateMap, putCurrentEntryIntoMap
 
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
createCollection, mapper, readItem, writeItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingletonMapConverter

public SingletonMapConverter(Mapper mapper)
Construct a SingletonMapConverter.

Parameters:
mapper -
Since:
1.4.2
Method Detail

canConvert

public boolean canConvert(Class type)
Description copied from interface: ConverterMatcher
Determines whether the converter can marshall a particular type.

Specified by:
canConvert in interface ConverterMatcher
Overrides:
canConvert in class MapConverter
Parameters:
type - the Class representing the object type to be converted

unmarshal

public Object unmarshal(HierarchicalStreamReader reader,
                        UnmarshallingContext context)
Description copied from interface: Converter
Convert textual data back into an object.

Specified by:
unmarshal in interface Converter
Overrides:
unmarshal in class MapConverter
Parameters:
reader - The stream to read the text from.
Returns:
The resulting object.


Copyright © 2004-2014 XStream. All Rights Reserved.