com.thoughtworks.xstream.converters.collections
Class SingletonCollectionConverter
java.lang.Object
com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
com.thoughtworks.xstream.converters.collections.CollectionConverter
com.thoughtworks.xstream.converters.collections.SingletonCollectionConverter
- All Implemented Interfaces:
- Converter, ConverterMatcher
public class SingletonCollectionConverter
- extends CollectionConverter
Converts singleton collections (list and set) to XML, specifying a nested element for the
item.
Supports Collections.singleton(Object) and Collections.singletonList(Object).
- Since:
- 1.4.2
- Author:
- Jörg Schaible
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingletonCollectionConverter
public SingletonCollectionConverter(Mapper mapper)
- Construct a SingletonCollectionConverter.
- Parameters:
mapper
- the mapper- Since:
- 1.4.2
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 CollectionConverter
- 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 CollectionConverter
- Parameters:
reader
- The stream to read the text from.
- Returns:
- The resulting object.
Copyright © 2004-2014 XStream. All Rights Reserved.