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.
| Access | Constructor and Description |
|---|---|
| public | |
| public | MapConverter(Mapper
the mapper mapper, Class<T> the type to handle type)Construct a MapConverter for a special Map type. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canConvert(Class<T>
the Class representing the object type to be converted type)Implements abstract com. Implements com. |
| protected Object | |
| public void | marshal(Object
The object to be marshalled. source, HierarchicalStreamWriter A stream to write to. writer, MarshallingContext A context that allows nested objects to be processed by XStream. context)Implements abstract com. Implements com. |
| protected void | |
| protected void | populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map<K, V> map, Map<K, V> target)
|
| protected void | putCurrentEntryIntoMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map<K, V> map, Map<K, V> target)
|
| public Object | unmarshal(HierarchicalStreamReader
The stream to read the text from. reader, UnmarshallingContext context)Implements abstract com. Implements com. |
| type | back to summary |
|---|---|
| private final Class<T> type | |
| MapConverter | back to summary |
|---|---|
| public MapConverter(Mapper mapper) | |
| MapConverter | back to summary |
|---|---|
| public MapConverter(Mapper mapper, Class<T> type) Construct a MapConverter for a special Map type. | |
| canConvert | back to summary |
|---|---|
| public boolean canConvert(Class<T> type) Implements abstract com. Implements com. Doc from com. Determines whether the converter can marshall a particular type.
| |
| createCollection | back to summary |
|---|---|
| protected Object createCollection(Class<T> type) Overrides com. | |
| marshal | back to summary |
|---|---|
| public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) Implements abstract com. Implements com. Doc from com. Convert an object to textual data.
| |
| populateMap | back to summary |
|---|---|
| protected void populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map<K, V> map) | |
| populateMap | back to summary |
|---|---|
| protected void populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map<K, V> map, Map<K, V> target) | |
| putCurrentEntryIntoMap | back to summary |
|---|---|
| protected void putCurrentEntryIntoMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map<K, V> map, Map<K, V> target) | |
| unmarshal | back to summary |
|---|---|
| public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) Implements abstract com. Implements com. Doc from com. Convert textual data back into an object.
| |