Class NamedCollectionConverter
- java.lang.Object
-
- com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
-
- com.thoughtworks.xstream.converters.collections.CollectionConverter
-
- com.thoughtworks.xstream.converters.extended.NamedCollectionConverter
-
- All Implemented Interfaces:
Converter
,ConverterMatcher
public class NamedCollectionConverter extends CollectionConverter
A collection converter that uses predefined names for its items.To be used as local converter. Note, suppress the usage of the implicit type argument, if registered with annotation.
- Since:
- 1.4.5
-
-
Constructor Summary
Constructors Constructor Description NamedCollectionConverter(Mapper mapper, java.lang.String itemName, java.lang.Class itemType)
Constructs a NamedCollectionConverter.NamedCollectionConverter(java.lang.Class type, Mapper mapper, java.lang.String itemName, java.lang.Class itemType)
Constructs a NamedCollectionConverter handling an explicit Collection type.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.lang.Object
readBareItem(HierarchicalStreamReader reader, UnmarshallingContext context, java.lang.Object current)
Read a bare item of the collection from the reader.protected void
writeCompleteItem(java.lang.Object item, MarshallingContext context, HierarchicalStreamWriter writer)
Write an item of the collection into the writer including surrounding tags.protected void
writeItem(java.lang.Object item, MarshallingContext context, HierarchicalStreamWriter writer)
Deprecated.As of 1.4.11 usewriteCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)
instead.-
Methods inherited from class com.thoughtworks.xstream.converters.collections.CollectionConverter
addCurrentElementToCollection, canConvert, createCollection, marshal, populateCollection, populateCollection, unmarshal
-
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
mapper, readCompleteItem, readItem, writeBareItem, writeNullItem
-
-
-
-
Constructor Detail
-
NamedCollectionConverter
public NamedCollectionConverter(Mapper mapper, java.lang.String itemName, java.lang.Class itemType)
Constructs a NamedCollectionConverter.- Parameters:
mapper
- the mapperitemName
- the name of the itemsitemType
- the base type of the items- Since:
- 1.4.5
-
NamedCollectionConverter
public NamedCollectionConverter(java.lang.Class type, Mapper mapper, java.lang.String itemName, java.lang.Class itemType)
Constructs a NamedCollectionConverter handling an explicit Collection type.- Parameters:
type
- the Collection type to handlemapper
- the mapperitemName
- the name of the itemsitemType
- the base type of the items- Since:
- 1.4.5
-
-
Method Detail
-
writeCompleteItem
protected void writeCompleteItem(java.lang.Object item, MarshallingContext context, HierarchicalStreamWriter writer)
Description copied from class:AbstractCollectionConverter
Write an item of the collection into the writer including surrounding tags.- Overrides:
writeCompleteItem
in classAbstractCollectionConverter
- Parameters:
item
- the item to writecontext
- the current marshalling contextwriter
- the target writer
-
writeItem
protected void writeItem(java.lang.Object item, MarshallingContext context, HierarchicalStreamWriter writer)
Deprecated.As of 1.4.11 usewriteCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)
instead.- Overrides:
writeItem
in classAbstractCollectionConverter
-
readBareItem
protected java.lang.Object readBareItem(HierarchicalStreamReader reader, UnmarshallingContext context, java.lang.Object current)
Description copied from class:AbstractCollectionConverter
Read a bare item of the collection from the reader.- Overrides:
readBareItem
in classAbstractCollectionConverter
- Parameters:
reader
- the source readercontext
- the unmarshalling contextcurrent
- the target collection (if already available)- Returns:
- the read item
-
-