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
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNamedCollectionConverter(Mapper mapper, String itemName, Class itemType) Constructs a NamedCollectionConverter.NamedCollectionConverter(Class type, Mapper mapper, String itemName, Class itemType) Constructs a NamedCollectionConverter handling an explicit Collection type. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectreadBareItem(HierarchicalStreamReader reader, UnmarshallingContext context, Object current) Read a bare item of the collection from the reader.protected voidwriteCompleteItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) Write an item of the collection into the writer including surrounding tags.protected voidwriteItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) Deprecated.Methods inherited from class CollectionConverter
addCurrentElementToCollection, canConvert, createCollection, marshal, populateCollection, populateCollection, unmarshalMethods inherited from class AbstractCollectionConverter
mapper, readCompleteItem, readItem, writeBareItem, writeNullItem
-
Field Details
-
name
-
type
-
-
Constructor Details
-
NamedCollectionConverter
-
NamedCollectionConverter
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 Details
-
writeCompleteItem
protected void writeCompleteItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) Description copied from class:AbstractCollectionConverterWrite an item of the collection into the writer including surrounding tags.- Overrides:
writeCompleteItemin classAbstractCollectionConverter- Parameters:
item- the item to writecontext- the current marshalling contextwriter- the target writer
-
writeItem
Deprecated.As of 1.4.11 usewriteCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)instead.- Overrides:
writeItemin classAbstractCollectionConverter
-
readBareItem
protected Object readBareItem(HierarchicalStreamReader reader, UnmarshallingContext context, Object current) Description copied from class:AbstractCollectionConverterRead a bare item of the collection from the reader.- Overrides:
readBareItemin classAbstractCollectionConverter- Parameters:
reader- the source readercontext- the unmarshalling contextcurrent- the target collection (if already available)- Returns:
- the read item
-
writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)instead.