Top Description Fields Constructors Methods
com.thoughtworks.xstream.io

public abstract Class WriterWrapper

extends Object
implements ExtendedHierarchicalStreamWriter
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter, com.thoughtworks.xstream.io.HierarchicalStreamWriter
Known Direct Subclasses
com.thoughtworks.xstream.io.path.PathTrackingWriter, com.thoughtworks.xstream.io.StatefulWriter

Deprecated

as a consequence of ExtendedHierarchicalStreamWriter being deprecated. See corresponding docs for further information.

Base class to make it easy to create wrappers (decorators) for HierarchicalStreamWriter.
Author
Joe Walnes

Field Summary

Modifier and TypeField and Description
protected HierarchicalStreamWriter

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
public void
close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.close.

Close the writer, if necessary.
public void
public void
flush()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.flush.

Flush the writer, if necessary.
public void
setValue(String text)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.setValue.

Write the value (text content) of the current node.
public void
public void
public HierarchicalStreamWriter
underlyingWriter()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.underlyingWriter.

Return the underlying HierarchicalStreamWriter implementation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

wrappedback to summary
protected HierarchicalStreamWriter wrapped

Constructor Detail

WriterWrapperback to summary
protected WriterWrapper(HierarchicalStreamWriter wrapped)

Method Detail

addAttributeback to summary
public void addAttribute(String key, String value)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.addAttribute.

closeback to summary
public void close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.close.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamWriter.close.

Close the writer, if necessary.

endNodeback to summary
public void endNode()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.endNode.

flushback to summary
public void flush()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.flush.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamWriter.flush.

Flush the writer, if necessary.

setValueback to summary
public void setValue(String text)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.setValue.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamWriter.setValue.

Write the value (text content) of the current node.

startNodeback to summary
public void startNode(String name)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.startNode.

startNodeback to summary
public void startNode(String name, Class<T> clazz)

Implements com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter.startNode.

underlyingWriterback to summary
public HierarchicalStreamWriter underlyingWriter()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.underlyingWriter.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamWriter.underlyingWriter.

Return the underlying HierarchicalStreamWriter implementation.

If a Converter needs to access methods of a specific HierarchicalStreamWriter implementation that are not defined in the HierarchicalStreamWriter interface, it should call this method before casting. This is because the writer passed to the Converter is often wrapped/decorated by another implementation to provide additional functionality (such as XPath tracking).

For example:

MySpecificWriter mySpecificWriter = (MySpecificWriter)writer; // INCORRECT!
mySpecificWriter.doSomethingSpecific();
MySpecificWriter mySpecificWriter = (MySpecificWriter)writer.underlyingWriter();  // CORRECT!
mySpecificWriter.doSomethingSpecific();

Implementations of HierarchicalStreamWriter should return 'this', unless they are a decorator, in which case they should delegate to whatever they are wrapping.