org.apache.shindig.protocol.conversion.xstream
Class StackWriterWrapper

java.lang.Object
  extended by com.thoughtworks.xstream.io.WriterWrapper
      extended by org.apache.shindig.protocol.conversion.xstream.StackWriterWrapper
All Implemented Interfaces:
com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter, com.thoughtworks.xstream.io.HierarchicalStreamWriter

public class StackWriterWrapper
extends com.thoughtworks.xstream.io.WriterWrapper

A Writer that provides a Stack based tracking of the location of the underlying writer.


Field Summary
 
Fields inherited from class com.thoughtworks.xstream.io.WriterWrapper
wrapped
 
Constructor Summary
StackWriterWrapper(com.thoughtworks.xstream.io.HierarchicalStreamWriter wrapped, WriterStack writerStack, Map<String,NamespaceSet> namespaces)
          Create a StackWriterWrapper that wraps a HierarchicalStreamWriter and tracks where that writer is in the hierarchy.
 
Method Summary
 void addAttribute(String name, String value)
          Set attribute values on the current node, but filter out class attributes from the writer, this is not strictly a feature of this class, but is required (for shindig to meet the XSD requirements.
 void endNode()
          End the current node, making the parent node the active node.
 void startNode(String name)
          Begin a new element or node of the supplied name.
 void startNode(String name, Class clazz)
          Start a node with a specific class.
 
Methods inherited from class com.thoughtworks.xstream.io.WriterWrapper
close, flush, setValue, underlyingWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackWriterWrapper

public StackWriterWrapper(com.thoughtworks.xstream.io.HierarchicalStreamWriter wrapped,
                          WriterStack writerStack,
                          Map<String,NamespaceSet> namespaces)
Create a StackWriterWrapper that wraps a HierarchicalStreamWriter and tracks where that writer is in the hierarchy.

Parameters:
wrapped - the underlying writer
writerStack - the stack that will record where the writer is.
namespaces -
Method Detail

addAttribute

public void addAttribute(String name,
                         String value)
Set attribute values on the current node, but filter out class attributes from the writer, this is not strictly a feature of this class, but is required (for shindig to meet the XSD requirements.

Specified by:
addAttribute in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter
Overrides:
addAttribute in class com.thoughtworks.xstream.io.WriterWrapper
Parameters:
name - the name of attribute
value - the value of the attribute.
See Also:
WriterWrapper.addAttribute(java.lang.String, java.lang.String)

startNode

public void startNode(String name)
Begin a new element or node of the supplied name.

Specified by:
startNode in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter
Overrides:
startNode in class com.thoughtworks.xstream.io.WriterWrapper
Parameters:
name - the name of the node.
See Also:
WriterWrapper.startNode(java.lang.String )

startNode

public void startNode(String name,
                      Class clazz)
Start a node with a specific class. This may invoke startNode(String) so we might have double recording of the position in the stack. This would be a bug.

Specified by:
startNode in interface com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter
Overrides:
startNode in class com.thoughtworks.xstream.io.WriterWrapper
See Also:
WriterWrapper.startNode(java.lang.String , java.lang.Class)

endNode

public void endNode()
End the current node, making the parent node the active node.

Specified by:
endNode in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter
Overrides:
endNode in class com.thoughtworks.xstream.io.WriterWrapper
See Also:
WriterWrapper.endNode()


Copyright © 2007-2012. All Rights Reserved.