public class MapConverter extends AbstractCollectionConverter
Note: 'key' and 'value' is not the name of the generated tag. The children are serialized as normal elements and the implementation expects them in the order 'key'/'value'.
Supports java.util.HashMap, java.util.Hashtable and java.util.LinkedHashMap.
| Constructor and Description |
|---|
MapConverter(Mapper mapper) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canConvert(Class type)
Determines whether the converter can marshall a particular type.
|
void |
marshal(Object source,
HierarchicalStreamWriter writer,
MarshallingContext context)
Convert an object to textual data.
|
protected void |
populateMap(HierarchicalStreamReader reader,
UnmarshallingContext context,
Map map) |
Object |
unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context)
Convert textual data back into an object.
|
createCollection, mapper, readItem, writeItempublic MapConverter(Mapper mapper)
public boolean canConvert(Class type)
ConverterMatchercanConvert in interface ConverterMatchercanConvert in class AbstractCollectionConvertertype - the Class representing the object type to be convertedpublic void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Convertermarshal in interface Convertermarshal in class AbstractCollectionConvertersource - The object to be marshalled.writer - A stream to write to.context - A context that allows nested objects to be processed by XStream.public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Converterunmarshal in interface Converterunmarshal in class AbstractCollectionConverterreader - The stream to read the text from.protected void populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map map)
Copyright © 2021 Internet2. All rights reserved.