|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thoughtworks.xstream.io.xml.AbstractXmlReader
com.thoughtworks.xstream.io.xml.AbstractPullReader
public abstract class AbstractPullReader
Base class that contains common functionality across HierarchicalStreamReader implementations that need to read from a pull parser.
Field Summary | |
---|---|
protected static int |
COMMENT
|
protected static int |
END_NODE
|
protected static int |
OTHER
|
protected static int |
START_NODE
|
protected static int |
TEXT
|
Constructor Summary | |
---|---|
protected |
AbstractPullReader(XmlFriendlyReplacer replacer)
|
Method Summary | |
---|---|
java.util.Iterator |
getAttributeNames()
Names of attributes (as Strings). |
java.lang.String |
getNodeName()
Get the name of the current node. |
java.lang.String |
getValue()
Get the value (text content) of the current node. |
boolean |
hasMoreChildren()
Does the node have any more children remaining that have not yet been read? |
void |
mark()
|
void |
moveDown()
|
void |
moveUp()
|
protected abstract java.lang.String |
pullElementName()
Pull the name of the current element from the stream. |
protected abstract int |
pullNextEvent()
Pull the next event from the stream. |
protected abstract java.lang.String |
pullText()
Pull the contents of the current text node from the stream. |
void |
reset()
|
HierarchicalStreamReader |
underlyingReader()
Return the underlying HierarchicalStreamReader implementation. |
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlReader |
---|
unescapeXmlName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.thoughtworks.xstream.io.HierarchicalStreamReader |
---|
appendErrors, close, getAttribute, getAttribute, getAttributeCount, getAttributeName |
Field Detail |
---|
protected static final int START_NODE
protected static final int END_NODE
protected static final int TEXT
protected static final int COMMENT
protected static final int OTHER
Constructor Detail |
---|
protected AbstractPullReader(XmlFriendlyReplacer replacer)
Method Detail |
---|
protected abstract int pullNextEvent()
This MUST return START_NODE
, END_NODE
, TEXT
, COMMENT
,
OTHER
or throw StreamException
.
The underlying pull parser will most likely return its own event types. These must be mapped to the appropriate events.
protected abstract java.lang.String pullElementName()
protected abstract java.lang.String pullText()
public boolean hasMoreChildren()
HierarchicalStreamReader
public void moveDown()
public void moveUp()
public void mark()
public void reset()
public java.lang.String getValue()
HierarchicalStreamReader
public java.util.Iterator getAttributeNames()
HierarchicalStreamReader
public java.lang.String getNodeName()
HierarchicalStreamReader
public HierarchicalStreamReader underlyingReader()
HierarchicalStreamReader
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |