public class DefaultNode extends Object implements Node
Node.State, Node.Visitor| Constructor and Description |
|---|
DefaultNode(Accessor accessor,
Class<?> valueType) |
DefaultNode(Class<?> valueType) |
DefaultNode(Node parentNode,
Accessor accessor,
Class<?> valueType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addChild(Node node)
Adds a child to this node and sets this node as its parent node.
|
Object |
canonicalGet(Object target) |
void |
canonicalSet(Object target,
Object value) |
void |
canonicalUnset(Object target) |
boolean |
equals(Object o) |
Object |
get(Object target) |
Set<String> |
getCategories() |
Node |
getChild(Element pathElement)
Retrieve a child that matches the given path element relative to this node.
|
Node |
getChild(PropertyPath path)
Retrieve a child that matches the given absolute path, starting from the current node.
|
Node |
getChild(String propertyName)
Retrieve a child with the given property name relative to this node.
|
Collection<Node> |
getChildren() |
Node |
getParentNode() |
Element |
getPathElement() |
PropertyPath |
getPropertyPath() |
Node.State |
getState() |
Class<?> |
getType() |
boolean |
hasChanges() |
boolean |
hasChildren() |
int |
hashCode() |
boolean |
isAdded()
Convenience method for
|
boolean |
isChanged()
Convenience method for
|
boolean |
isCircular()
Convenience method for
|
boolean |
isCollectionNode() |
boolean |
isEqualsOnly() |
boolean |
isIgnored()
Convenience method for
|
boolean |
isMapNode() |
boolean |
isRemoved()
Convenience method for
|
boolean |
isRootNode() |
boolean |
isUntouched()
Convenience method for
|
boolean |
matches(PropertyPath path) |
void |
set(Object target,
Object value) |
void |
setParentNode(Node parentNode)
Sets the parent node.
|
void |
setState(Node.State state) |
void |
setType(Class<?> aClass)
Allows for explicit type definition.
|
CollectionNode |
toCollectionNode() |
MapNode |
toMapNode() |
String |
toString() |
void |
unset(Object target) |
void |
visit(Node.Visitor visitor)
Visit this and all child nodes.
|
protected void |
visit(Node.Visitor visitor,
Visit visit) |
void |
visitChildren(Node.Visitor visitor)
Visit all child nodes but not this one.
|
public DefaultNode(Class<?> valueType)
public Node.State getState()
public boolean matches(PropertyPath path)
public boolean hasChanges()
hasChanges in interface Nodepublic final boolean isAdded()
NodeNode.getState() == Node.State.ADDEDpublic final boolean isChanged()
NodeNode.getState() == Node.State.CHANGEDpublic final boolean isRemoved()
NodeNode.getState() == Node.State.REMOVEDpublic final boolean isUntouched()
NodeNode.getState() == Node.State.UNTOUCHEDisUntouched in interface Nodepublic boolean isCircular()
NodeNode.getState() == Node.State.CIRCULARisCircular in interface Nodepublic final PropertyPath getPropertyPath()
getPropertyPath in interface Nodepublic Element getPathElement()
getPathElement in interface PropertyDescriptorpublic boolean isCollectionNode()
isCollectionNode in interface Nodepublic CollectionNode toCollectionNode()
toCollectionNode in interface Nodepublic Class<?> getType()
public void setType(Class<?> aClass)
NodeNode.getType() will always
return the type returned by the accessor.public boolean hasChildren()
hasChildren in interface Nodetrue if this node has children.public Collection<Node> getChildren()
getChildren in interface Nodepublic Node getChild(String propertyName)
Nodepublic Node getChild(PropertyPath path)
Nodepublic Node getChild(Element pathElement)
Nodepublic boolean addChild(Node node)
Nodepublic final void visit(Node.Visitor visitor)
Nodeprotected final void visit(Node.Visitor visitor, Visit visit)
public final void visitChildren(Node.Visitor visitor)
NodevisitChildren in interface Nodevisitor - The visitor to use.public final boolean isRootNode()
isRootNode in interface Nodepublic final boolean isEqualsOnly()
isEqualsOnly in interface PropertyDescriptorpublic final boolean isIgnored()
NodeNode.getState() == Node.State.IGNOREDisIgnored in interface PropertyDescriptorisIgnored in interface Nodepublic final Set<String> getCategories()
getCategories in interface PropertyDescriptorpublic void setState(Node.State state)
public Node getParentNode()
getParentNode in interface Nodepublic final void setParentNode(Node parentNode)
NodesetParentNode in interface NodeparentNode - The parent of this node. May be null, if this is a root node.public Object canonicalGet(Object target)
canonicalGet in interface CanonicalAccessorpublic void canonicalSet(Object target, Object value)
canonicalSet in interface CanonicalAccessorpublic void canonicalUnset(Object target)
canonicalUnset in interface CanonicalAccessorCopyright © 2012. All Rights Reserved.