To be used as local converter. Note, suppress the usage of the implicit type argument, if registered with annotation. Depending on the constructor arguments it is possible to support various formats:
<map>
<entry>
<key>keyValue</key>
<value>0</value>
</entry>
</map>
<map> <key>keyValue</key> <value>0</value> </map>
<map> <entry> key="keyValue" value="0"/> </map>
<map>
<entry key="keyValue">
<value>0</value>
</entry>
</map>
<map>
<entry value="0">
<key>keyValue</key>
</entry>
</map>
<map> <entry key="keyValue">0</entry> </map>
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final Mapper | |
| private final boolean | |
| private final String | |
| private final Class | |
| private final ConverterLookup | |
| private final boolean | |
| private final String | |
| private final Class |
| Access | Constructor and Description |
|---|---|
| public | NamedMapConverter(Mapper
the mapper mapper, String the name of the entry elements entryName, String the name of the key elements keyName, Class<T> the base type of key elements keyType, String the name of the value elements valueName, Class<T> the base type of value elements valueType)Constructs a NamedMapConverter. |
| public | NamedMapConverter(Class<T>
the Map type this instance will handle type, Mapper the mapper mapper, String the name of the entry elements entryName, String the name of the key elements keyName, Class<T> the base type of key elements keyType, String the name of the value elements valueName, Class<T> the base type of value elements valueType)Constructs a NamedMapConverter handling an explicit Map type. |
| public | NamedMapConverter(Mapper
the mapper mapper, String the name of the entry elements entryName, String the name of the key elements keyName, Class<T> the base type of key elements keyType, String the name of the value elements valueName, Class<T> the base type of value elements valueType, boolean flag to write key as attribute of entry element keyAsAttribute, boolean flag to write value as attribute of entry element valueAsAttribute, ConverterLookup used to lookup SingleValueConverter for attributes lookup)Constructs a NamedMapConverter with attribute support. |
| public | NamedMapConverter(Class<T>
the Map type this instance will handle type, Mapper the mapper mapper, String the name of the entry elements entryName, String the name of the key elements keyName, Class<T> the base type of key elements keyType, String the name of the value elements valueName, Class<T> the base type of value elements valueType, boolean flag to write key as attribute of entry element keyAsAttribute, boolean flag to write value as attribute of entry element valueAsAttribute, ConverterLookup used to lookup SingleValueConverter for attributes lookup)Constructs a NamedMapConverter with attribute support handling an explicit Map type. |
| Modifier and Type | Method and Description |
|---|---|
| private SingleValueConverter | |
| 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)Overrides com. Implements com. |
| protected void | populateMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map<K, V> map, Map<K, V> target)
Overrides com. |
| protected Object | readItem(Class<T> type, HierarchicalStreamReader reader, UnmarshallingContext context, Object current)
|
| protected void | writeItem(String name, Class<T> type, Object item, MarshallingContext context, HierarchicalStreamWriter writer)
|
| entryName | back to summary |
|---|---|
| private final String entryName | |
| enumMapper | back to summary |
|---|---|
| private final Mapper enumMapper | |
| keyAsAttribute | back to summary |
|---|---|
| private final boolean keyAsAttribute | |
| keyName | back to summary |
|---|---|
| private final String keyName | |
| keyType | back to summary |
|---|---|
| private final Class<T> keyType | |
| lookup | back to summary |
|---|---|
| private final ConverterLookup lookup | |
| valueAsAttribute | back to summary |
|---|---|
| private final boolean valueAsAttribute | |
| valueName | back to summary |
|---|---|
| private final String valueName | |
| valueType | back to summary |
|---|---|
| private final Class<T> valueType | |
| NamedMapConverter | back to summary |
|---|---|
| public NamedMapConverter(Mapper mapper, String entryName, String keyName, Class<T> keyType, String valueName, Class<T> valueType) Constructs a NamedMapConverter. | |
| NamedMapConverter | back to summary |
|---|---|
| public NamedMapConverter(Class<T> type, Mapper mapper, String entryName, String keyName, Class<T> keyType, String valueName, Class<T> valueType) Constructs a NamedMapConverter handling an explicit Map type.
| |
| NamedMapConverter | back to summary |
|---|---|
| public NamedMapConverter(Mapper mapper, String entryName, String keyName, Class<T> keyType, String valueName, Class<T> valueType, boolean keyAsAttribute, boolean valueAsAttribute, ConverterLookup lookup) Constructs a NamedMapConverter with attribute support.
| |
| NamedMapConverter | back to summary |
|---|---|
| public NamedMapConverter(Class<T> type, Mapper mapper, String entryName, String keyName, Class<T> keyType, String valueName, Class<T> valueType, boolean keyAsAttribute, boolean valueAsAttribute, ConverterLookup lookup) Constructs a NamedMapConverter with attribute support handling an explicit Map type.
| |
| getSingleValueConverter | back to summary |
|---|---|
| private SingleValueConverter getSingleValueConverter(Class<T> type, String part) | |
| marshal | back to summary |
|---|---|
| public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) Overrides 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, Map<K, V> target) Overrides com. | |
| readItem | back to summary |
|---|---|
| protected Object readItem(Class<T> type, HierarchicalStreamReader reader, UnmarshallingContext context, Object current) | |
| writeItem | back to summary |
|---|---|
| protected void writeItem(String name, Class<T> type, Object item, MarshallingContext context, HierarchicalStreamWriter writer) | |