public abstract class AbstractReader extends java.lang.Object implements ExtendedHierarchicalStreamReader
HierarchicalStreamReader
should rather be derived from this class then implementing
the interface directly.Modifier | Constructor and Description |
---|---|
protected |
AbstractReader()
Creates an AbstractReader with a NameCoder that does nothing.
|
protected |
AbstractReader(NameCoder nameCoder)
Creates an AbstractReader with a provided
NameCoder . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
decodeAttribute(java.lang.String name)
Decode an attribute name from the target format.
|
java.lang.String |
decodeNode(java.lang.String name)
Decode a node name from the target format.
|
protected java.lang.String |
encodeAttribute(java.lang.String name)
Encode the attribute name again into the name of the target format.
|
protected java.lang.String |
encodeNode(java.lang.String name)
Encode the node name again into the name of the target format.
|
java.lang.String |
peekNextChild()
Peek the name of the next child.
|
HierarchicalStreamReader |
underlyingReader()
Return the underlying HierarchicalStreamReader implementation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendErrors, close, getAttribute, getAttribute, getAttributeCount, getAttributeName, getAttributeNames, getNodeName, getValue, hasMoreChildren, moveDown, moveUp
protected AbstractReader()
public HierarchicalStreamReader underlyingReader()
If a Converter needs to access methods of a specific HierarchicalStreamReader implementation that are not defined in the HierarchicalStreamReader interface, it should call this method before casting. This is because the reader passed to the Converter is often wrapped/decorated by another implementation to provide additional functionality (such as XPath tracking).
For example:
MySpecificReader mySpecificReader = (MySpecificReader)reader; // INCORRECT! mySpecificReader.doSomethingSpecific();
MySpecificReader mySpecificReader = (MySpecificReader)reader.underlyingReader(); // CORRECT! mySpecificReader.doSomethingSpecific();
Implementations of HierarchicalStreamReader should return 'this', unless they are a decorator, in which case they should delegate to whatever they are wrapping.
underlyingReader
in interface HierarchicalStreamReader
public java.lang.String decodeNode(java.lang.String name)
name
- the name in the target formatpublic java.lang.String decodeAttribute(java.lang.String name)
name
- the name in the target formatprotected java.lang.String encodeNode(java.lang.String name)
name
- the original nameprotected java.lang.String encodeAttribute(java.lang.String name)
name
- the original namepublic java.lang.String peekNextChild()
ExtendedHierarchicalStreamReader
HierarchicalStreamReader.hasMoreChildren()
returns
true, peek the tag name of the child.peekNextChild
in interface ExtendedHierarchicalStreamReader
Copyright © 2004–2024 XStream. All rights reserved.