|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.danielbechler.diff.node.DefaultNode
public class DefaultNode
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.danielbechler.diff.node.Node |
---|
Node.State, Node.Visitor |
Field Summary |
---|
Fields inherited from interface de.danielbechler.diff.node.Node |
---|
ROOT |
Constructor Summary | |
---|---|
DefaultNode(Accessor accessor,
Class<?> valueType)
|
|
DefaultNode(Class<?> valueType)
|
|
DefaultNode(Node parentNode,
Accessor accessor,
Class<?> valueType)
|
Method Summary | |
---|---|
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)
|
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()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultNode(Node parentNode, Accessor accessor, Class<?> valueType)
public DefaultNode(Accessor accessor, Class<?> valueType)
public DefaultNode(Class<?> valueType)
Method Detail |
---|
public Node.State getState()
getState
in interface Node
public boolean matches(PropertyPath path)
matches
in interface Node
public boolean hasChanges()
hasChanges
in interface Node
public final boolean isAdded()
Node
Node.getState()
== Node.State.ADDED
isAdded
in interface Node
public final boolean isChanged()
Node
Node.getState()
== Node.State.CHANGED
isChanged
in interface Node
public final boolean isRemoved()
Node
Node.getState()
== Node.State.REMOVED
isRemoved
in interface Node
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 boolean isMapNode()
isMapNode
in interface Node
public MapNode toMapNode()
toMapNode
in interface Node
public Class<?> getType()
getType
in interface Node
public void setType(Class<?> aClass)
Node
Node.getType()
will always
return the type returned by the accessor.
setType
in interface Node
aClass
- The type of the value represented by this node.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
getChild
in interface Node
propertyName
- The name of the property represented by the child node.
null
.public Node getChild(PropertyPath path)
Node
getChild
in interface Node
path
- The path from the object root to the requested child node.
null
.public Node getChild(Element pathElement)
Node
getChild
in interface Node
pathElement
- The path element of the childe node to get.
null
.public boolean addChild(Node node)
Node
addChild
in interface Node
node
- The node to add.public final void visit(Node.Visitor visitor)
Node
visit
in interface Node
visitor
- The visitor to use.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 final void setState(Node.State state)
setState
in interface Node
state
- The state of this node.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 get(Object target)
get
in interface Accessor
public void set(Object target, Object value)
set
in interface Accessor
public void unset(Object target)
unset
in interface Accessor
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
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |