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
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSingletonCollectionConverter(Mapper mapper) Construct a SingletonCollectionConverter. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanConvert(Class type) Determines whether the converter can marshall a particular type.unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) Convert textual data back into an object.Methods inherited from class CollectionConverter
addCurrentElementToCollection, createCollection, marshal, populateCollection, populateCollectionMethods inherited from class AbstractCollectionConverter
mapper, readBareItem, readCompleteItem, readItem, writeBareItem, writeCompleteItem, writeItem, writeNullItem
-
Field Details
-
LIST
-
SET
-
-
Constructor Details
-
SingletonCollectionConverter
Construct a SingletonCollectionConverter.- Parameters:
mapper- the mapper- Since:
- 1.4.2
-
-
Method Details
-
canConvert
Description copied from interface:ConverterMatcherDetermines whether the converter can marshall a particular type.- Specified by:
canConvertin interfaceConverterMatcher- Overrides:
canConvertin classCollectionConverter- Parameters:
type- the Class representing the object type to be converted
-
unmarshal
Description copied from interface:ConverterConvert textual data back into an object.- Specified by:
unmarshalin interfaceConverter- Overrides:
unmarshalin classCollectionConverter- Parameters:
reader- The stream to read the text from.context-- Returns:
- The resulting object.
-