org.axonframework.serializer.bson
Class DBObjectHierarchicalStreamWriter

java.lang.Object
  extended by org.axonframework.serializer.bson.DBObjectHierarchicalStreamWriter
All Implemented Interfaces:
com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter, com.thoughtworks.xstream.io.HierarchicalStreamWriter

public class DBObjectHierarchicalStreamWriter
extends Object
implements com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter

HierarchicalStreamWriter implementation that writes objects into a MongoDB DBObject structure. Use the DBObjectHierarchicalStreamReader to read the object back.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
DBObjectHierarchicalStreamWriter(com.mongodb.DBObject root)
          Initialize the writer to write the object structure to the given root DBObject.
 
Method Summary
 void addAttribute(String name, String value)
           
 void close()
           
 void endNode()
           
 void flush()
           
 void setValue(String text)
           
 void startNode(String name)
           
 void startNode(String name, Class clazz)
           
 com.thoughtworks.xstream.io.HierarchicalStreamWriter underlyingWriter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBObjectHierarchicalStreamWriter

public DBObjectHierarchicalStreamWriter(com.mongodb.DBObject root)
Initialize the writer to write the object structure to the given root DBObject.

Note that the given root DBObject must not contain any data yet.

Parameters:
root - The root DBObject to which the serialized structure will be added. Must not contain any data.
Method Detail

startNode

public void startNode(String name)
Specified by:
startNode in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

addAttribute

public void addAttribute(String name,
                         String value)
Specified by:
addAttribute in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

setValue

public void setValue(String text)
Specified by:
setValue in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

endNode

public void endNode()
Specified by:
endNode in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

flush

public void flush()
Specified by:
flush in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

close

public void close()
Specified by:
close in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

underlyingWriter

public com.thoughtworks.xstream.io.HierarchicalStreamWriter underlyingWriter()
Specified by:
underlyingWriter in interface com.thoughtworks.xstream.io.HierarchicalStreamWriter

startNode

public void startNode(String name,
                      Class clazz)
Specified by:
startNode in interface com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter


Copyright © 2010-2016. All Rights Reserved.