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 Object
readBareItem
(HierarchicalStreamReader reader, UnmarshallingContext context, Object current) Read a bare item of the collection from the reader.protected void
writeCompleteItem
(Object item, MarshallingContext context, HierarchicalStreamWriter writer) Write an item of the collection into the writer including surrounding tags.protected void
writeItem
(Object item, MarshallingContext context, HierarchicalStreamWriter writer) Deprecated.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
-
Field Details
-
name
-
type
-
-
Constructor Details
-
NamedCollectionConverter
Constructs a NamedCollectionConverter.- Parameters:
mapper
- the mapperitemName
- the name of the itemsitemType
- the base type of the items- Since:
- 1.4.5
-
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: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
Deprecated.As of 1.4.11 usewriteCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)
instead.- Overrides:
writeItem
in classAbstractCollectionConverter
-
readBareItem
protected Object readBareItem(HierarchicalStreamReader reader, UnmarshallingContext context, 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
-
writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)
instead.