|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
com.thoughtworks.xstream.converters.collections.MapConverter
public class MapConverter
Converts a java.util.Map to XML, specifying an 'entry' element with 'key' and 'value' children.
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, java.util.LinkedHashMap and java.util.concurrent.ConcurrentHashMap.
Constructor Summary | |
---|---|
MapConverter(Mapper mapper)
|
Method Summary | |
---|---|
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)
|
protected void |
populateMap(HierarchicalStreamReader reader,
UnmarshallingContext context,
Map map,
Map target)
|
protected void |
putCurrentEntryIntoMap(HierarchicalStreamReader reader,
UnmarshallingContext context,
Map map,
Map target)
|
Object |
unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context)
Convert textual data back into an object. |
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter |
---|
createCollection, mapper, readItem, writeItem |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapConverter(Mapper mapper)
Method Detail |
---|
public boolean canConvert(Class type)
ConverterMatcher
canConvert
in interface ConverterMatcher
canConvert
in class AbstractCollectionConverter
type
- the Class representing the object type to be convertedpublic void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Converter
marshal
in interface Converter
marshal
in class AbstractCollectionConverter
source
- 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)
Converter
unmarshal
in interface Converter
unmarshal
in class AbstractCollectionConverter
reader
- The stream to read the text from.
protected void populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map map)
protected void populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map map, Map target)
protected void putCurrentEntryIntoMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map map, Map target)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |