public interface NameCoder
The names form the object graph are typically names generated from Java identifiers (Java types or field members), but some names may also contain a minus sign. However, the original name might have already been aliased, so a wider range of characters can occur.
The target names should satisfy the syntax of the target format. Transforming Java objects to XML this affects names that contain or even start with a dollar sign. Such names violate the XML specification.
By default all names from the object graph are used as node names in the target format. Meta-data that is necessary to unmarshal the object again is typically written as attribute. Since such attributes might be represented differently in the target format, the NameCoder distinguishes between the names used for meta-data elements and the ones for the object data. The names in the target format might even have to follow a different syntax. Remember, that XStream can be easily configured to write also object data as attributes.
Note that the instance of a NameCoder should be either thread-safe or implement Cloneable
.
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.
|
java.lang.String encodeNode(java.lang.String name)
name
- the name of the object datajava.lang.String encodeAttribute(java.lang.String name)
name
- the name of the meta-datajava.lang.String decodeNode(java.lang.String nodeName)
nodeName
- the name of the nodejava.lang.String decodeAttribute(java.lang.String attributeName)
attributeName
- the name of the attributeCopyright © 2004–2024 XStream. All rights reserved.