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

public Class SingletonCollectionConverter

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

Converts singleton collections (list and set) to XML, specifying a nested element for the item.

Supports Collections.singleton(Object) and Collections.singletonList(Object).

Author
Jörg Schaible
Since
1.4.2

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
SingletonCollectionConverter(Mapper
the mapper
mapper
)

Construct a SingletonCollectionConverter.

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.CollectionConverter.canConvert.

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

Determines whether the converter can marshall a particular type.
public Object
Inherited from com.thoughtworks.xstream.converters.collections.CollectionConverter:
addCurrentElementToCollectioncreateCollectionmarshalpopulateCollectionpopulateCollection

Field Detail

LISTback to summary
private static final Class<T> LIST
SETback to summary
private static final Class<T> SET

Constructor Detail

SingletonCollectionConverterback to summary
public SingletonCollectionConverter(Mapper mapper)

Construct a SingletonCollectionConverter.

Parameters
mapper:Mapper

the mapper

Since
1.4.2

Method Detail

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

Overrides com.thoughtworks.xstream.converters.collections.CollectionConverter.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.CollectionConverter.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.