public class StaticNameCoder extends java.lang.Object implements NameCoder
The provided map should contain a mapping between the name of the Java type or field to the proper element in the target format. If a name cannot be found in the map, it is assumed not to be mapped at all. Note that the values of the map should be unique also, otherwise the decoding will produce wrong results.
Modifier and Type | Field and Description |
---|---|
private java.util.Map |
attribute2Java |
private java.util.Map |
java2Attribute |
private java.util.Map |
java2Node |
private java.util.Map |
node2Java |
Constructor and Description |
---|
StaticNameCoder(java.util.Map java2Node,
java.util.Map java2Attribute)
Construct a StaticNameCoder.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
decodeAttribute(java.lang.String attributeName)
Decode an attribute name to an object name.
|
java.lang.String |
decodeNode(java.lang.String nodeName)
Decode a node name to an object name.
|
java.lang.String |
encodeAttribute(java.lang.String name)
Encode a meta-data name for an attribute in the target format.
|
java.lang.String |
encodeNode(java.lang.String name)
Encode an object name for a node in the target format.
|
private java.util.Map |
invertMap(java.util.Map map) |
private java.lang.Object |
readResolve() |
private final java.util.Map java2Node
private final java.util.Map java2Attribute
private transient java.util.Map node2Java
private transient java.util.Map attribute2Java
public StaticNameCoder(java.util.Map java2Node, java.util.Map java2Attribute)
java2Node
- mapping of Java names to nodesjava2Attribute
- mapping of Java names to attributespublic java.lang.String decodeAttribute(java.lang.String attributeName)
decodeAttribute
in interface NameCoder
attributeName
- the name of the attributepublic java.lang.String decodeNode(java.lang.String nodeName)
decodeNode
in interface NameCoder
nodeName
- the name of the nodepublic java.lang.String encodeAttribute(java.lang.String name)
encodeAttribute
in interface NameCoder
name
- the name of the meta-datapublic java.lang.String encodeNode(java.lang.String name)
encodeNode
in interface NameCoder
name
- the name of the object dataprivate java.lang.Object readResolve()
private java.util.Map invertMap(java.util.Map map)