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 Node
public final boolean isAdded()
Node
Node.getState()
== Node.State.ADDED
public final boolean isChanged()
Node
Node.getState()
== Node.State.CHANGED
public final boolean isRemoved()
Node
Node.getState()
== Node.State.REMOVED
public final boolean isUntouched()
Node
Node.getState()
== Node.State.UNTOUCHED
isUntouched
in interface Node
public boolean isCircular()
Node
Node.getState()
== Node.State.CIRCULAR
isCircular
in interface Node
public final PropertyPath getPropertyPath()
getPropertyPath
in interface Node
public Element getPathElement()
getPathElement
in interface PropertyDescriptor
public boolean isCollectionNode()
isCollectionNode
in interface Node
public CollectionNode toCollectionNode()
toCollectionNode
in interface Node
public Class<?> getType()
public void setType(Class<?> aClass)
Node
Node.getType()
will always
return the type returned by the accessor.public boolean hasChildren()
hasChildren
in interface Node
true
if this node has children.public Collection<Node> getChildren()
getChildren
in interface Node
public Node getChild(String propertyName)
Node
public Node getChild(PropertyPath path)
Node
public Node getChild(Element pathElement)
Node
public boolean addChild(Node node)
Node
public final void visit(Node.Visitor visitor)
Node
protected final void visit(Node.Visitor visitor, Visit visit)
public final void visitChildren(Node.Visitor visitor)
Node
visitChildren
in interface Node
visitor
- The visitor to use.public final boolean isRootNode()
isRootNode
in interface Node
public final boolean isEqualsOnly()
isEqualsOnly
in interface PropertyDescriptor
public final boolean isIgnored()
Node
Node.getState()
== Node.State.IGNORED
isIgnored
in interface PropertyDescriptor
isIgnored
in interface Node
public final Set<String> getCategories()
getCategories
in interface PropertyDescriptor
public void setState(Node.State state)
public Node getParentNode()
getParentNode
in interface Node
public final void setParentNode(Node parentNode)
Node
setParentNode
in interface Node
parentNode
- The parent of this node. May be null, if this is a root node.public Object canonicalGet(Object target)
canonicalGet
in interface CanonicalAccessor
public void canonicalSet(Object target, Object value)
canonicalSet
in interface CanonicalAccessor
public void canonicalUnset(Object target)
canonicalUnset
in interface CanonicalAccessor
Copyright © 2012. All Rights Reserved.