|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.serializer.bson.BSONNode
public class BSONNode
Represents a node in a BSON structure. This class provides for an XML like abstraction around BSON for use by the XStream Serializer.
Constructor Summary | |
---|---|
BSONNode(String name)
Creates a node with given "code" name. |
Method Summary | |
---|---|
BSONNode |
addChildNode(String name)
Adds a child node to the current node. |
com.mongodb.DBObject |
asDBObject()
Returns the current BSON structure as DBObject. |
Map<String,String> |
attributes()
Returns a map containing the attributes of the current node. |
Iterator<BSONNode> |
children()
Returns an iterator providing access to the child nodes of the current node. |
static BSONNode |
fromDBObject(com.mongodb.DBObject node)
Constructrs a BSONNode structure from the given DBObject structure. |
String |
getAttribute(String name)
Returns the value of the attribute with given name . |
String |
getName()
Returns the name of the current node |
String |
getValue()
Returns the value of the current node |
void |
setAttribute(String attributeName,
String attributeValue)
Sets an attribute to this node. |
void |
setValue(String value)
Sets the value of this node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BSONNode(String name)
addChildNode(String)
.
Note that the given name
is encoded in a BSON compatible way. That means that periods (".") are
replaced by forward slashes "/", and any slashes are prefixes with additional slash. For example, the String
"some.period/slash" would become "some/period//slash". This is only imporant when querying BSON structures
directly.
name
- The name of this nodeMethod Detail |
---|
public static BSONNode fromDBObject(com.mongodb.DBObject node)
node
- The root DBObject node containing the BSON Structure
public com.mongodb.DBObject asDBObject()
public void setValue(String value)
value
- The value to set for this nodepublic void setAttribute(String attributeName, String attributeValue)
attributeName
- The name of the attribute to addattributeValue
- The value of the attributepublic BSONNode addChildNode(String name)
null
and may
not start with "attr_", in order to differentiate between child nodes and attributes.
name
- The name of the child node
public Iterator<BSONNode> children()
public Map<String,String> attributes()
public String getAttribute(String name)
name
.
name
- The name of the attribute to get the value for
null
if the attribute was not foundpublic String getValue()
null
if this node has no value.public String getName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |