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
-
-
Constructor Summary
Constructors Constructor Description SingletonCollectionConverter(Mapper mapper)
Construct a SingletonCollectionConverter.
-
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.CollectionConverter
addCurrentElementToCollection, createCollection, marshal, populateCollection, populateCollection
-
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItem
-
-
-
-
Constructor Detail
-
SingletonCollectionConverter
public SingletonCollectionConverter(Mapper mapper)
Construct a SingletonCollectionConverter.- Parameters:
mapper
- the 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 classCollectionConverter
- 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 classCollectionConverter
- Parameters:
reader
- The stream to read the text from.- Returns:
- The resulting object.
-
-