public class DiffNode
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static class |
DiffNode.State
The state of a
DiffNode representing the difference between two objects. |
static interface |
DiffNode.Visitor
Visitor to traverse a node graph.
|
构造器和说明 |
---|
DiffNode(DiffNode parentNode,
Accessor accessor) |
DiffNode(DiffNode parentNode,
Accessor accessor,
java.lang.Class<?> valueType) |
限定符和类型 | 方法和说明 |
---|---|
void |
addCategories(java.util.Collection<java.lang.String> additionalCategories) |
void |
addChild(DiffNode node)
Adds a child to this node and sets this node as its parent node.
|
java.lang.Object |
canonicalGet(java.lang.Object target) |
void |
canonicalSet(java.lang.Object target,
java.lang.Object value) |
void |
canonicalUnset(java.lang.Object target) |
int |
childCount() |
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get(java.lang.Object target) |
java.util.Set<java.lang.String> |
getCategories()
Returns an unmodifiable
Set of String with the categories of this node. |
DiffNode |
getChild(ElementSelector elementSelector)
Retrieve a child that matches the given path element relative to this node.
|
DiffNode |
getChild(java.util.List<ElementSelector> selectors)
Retrieve a child that matches the given path element relative to this node.
|
DiffNode |
getChild(NodePath nodePath)
Retrieve a child that matches the given absolute path, starting from the current node.
|
DiffNode |
getChild(java.lang.String propertyName)
Retrieve a child with the given property name relative to this node.
|
DiffNode |
getCircleStartNode() |
NodePath |
getCircleStartPath() |
ElementSelector |
getElementSelector() |
<T extends java.lang.annotation.Annotation> |
getFieldAnnotation(java.lang.Class<T> annotationClass) |
java.util.Set<java.lang.annotation.Annotation> |
getFieldAnnotations()
If this node represents a bean property this method returns all annotations of its field.
|
DiffNode |
getParentNode() |
NodePath |
getPath() |
<T extends java.lang.annotation.Annotation> |
getPropertyAnnotation(java.lang.Class<T> annotationClass) |
java.util.Set<java.lang.annotation.Annotation> |
getPropertyAnnotations()
If this node represents a bean property this method returns all annotations of its getter.
|
java.lang.String |
getPropertyName()
If this node represents a bean property, this method will simply return its name.
|
DiffNode.State |
getState() |
java.lang.Class<?> |
getValueType() |
TypeInfo |
getValueTypeInfo() |
boolean |
hasChanges() |
boolean |
hasChildren() |
int |
hashCode() |
boolean |
isAdded()
Convenience method for
|
boolean |
isChanged()
Convenience method for
|
boolean |
isCircular()
Convenience method for
|
boolean |
isExcluded()
已过时。
This method was a shortcut to extract the "exclude" flag from the ObjectDiffProperty
annotation. Since we found a better way to do that, it is not needed anymore and will be removed in future
versions. The name is also misleading. It implies that here lies the truth about the exclusion, but only the
InclusionService can tell for sure. This flag is just only little piece of the puzzle.
|
boolean |
isIgnored()
Convenience method for
|
boolean |
isPropertyAware()
Returns
true when this node represents a bean property and can therefore be queried for property
specific information like annotations or property types. |
boolean |
isRemoved()
Convenience method for
|
boolean |
isRootNode() |
boolean |
isUntouched()
Convenience method for
|
boolean |
matches(NodePath path) |
static DiffNode |
newRootNode() |
static DiffNode |
newRootNodeWithType(java.lang.Class<?> valueType) |
void |
set(java.lang.Object target,
java.lang.Object value) |
void |
setChildIdentityStrategy(IdentityStrategy identityStrategy) |
void |
setCircleStartNode(DiffNode circleStartNode) |
void |
setCircleStartPath(NodePath circularStartPath) |
protected void |
setParentNode(DiffNode parentNode)
Sets the parent node.
|
void |
setState(DiffNode.State state) |
void |
setType(java.lang.Class<?> aClass)
Allows to explicity set the type of this node.
|
void |
setValueTypeInfo(TypeInfo typeInfo) |
java.lang.String |
toString() |
void |
unset(java.lang.Object target) |
void |
visit(DiffNode.Visitor visitor)
Visit this and all child nodes.
|
protected void |
visit(DiffNode.Visitor visitor,
Visit visit) |
void |
visitChildren(DiffNode.Visitor visitor)
Visit all child nodes but not this one.
|
void |
visitParents(DiffNode.Visitor visitor) |
public static final DiffNode ROOT
public void setChildIdentityStrategy(IdentityStrategy identityStrategy)
public static DiffNode newRootNode()
public static DiffNode newRootNodeWithType(java.lang.Class<?> valueType)
public DiffNode.State getState()
public void setState(DiffNode.State state)
state
- The state of this node.public boolean matches(NodePath path)
public boolean hasChanges()
public final boolean isAdded()
getState()
== DiffNode.State.ADDED
public final boolean isChanged()
getState()
== DiffNode.State.CHANGED
public final boolean isRemoved()
getState()
== DiffNode.State.REMOVED
public final boolean isUntouched()
getState()
== DiffNode.State.UNTOUCHED
public boolean isCircular()
getState()
== DiffNode.State.CIRCULAR
public NodePath getPath()
public ElementSelector getElementSelector()
public java.lang.Class<?> getValueType()
public final void setType(java.lang.Class<?> aClass)
aClass
- The type of the value represented by this node.public TypeInfo getValueTypeInfo()
public void setValueTypeInfo(TypeInfo typeInfo)
public boolean hasChildren()
true
if this node has children.public int childCount()
public DiffNode getChild(java.lang.String propertyName)
propertyName
- The name of the property represented by the child node.null
.public DiffNode getChild(ElementSelector elementSelector)
elementSelector
- The path element of the child node to get.null
.public DiffNode getChild(NodePath nodePath)
nodePath
- The path from the object root to the requested child node.null
.public DiffNode getChild(java.util.List<ElementSelector> selectors)
selectors
- The path element of the child node to get.null
.public void addChild(DiffNode node)
node
- The node to add.public final void visit(DiffNode.Visitor visitor)
visitor
- The visitor to use.protected final void visit(DiffNode.Visitor visitor, Visit visit)
public final void visitChildren(DiffNode.Visitor visitor)
visitor
- The visitor to use.public final void visitParents(DiffNode.Visitor visitor)
public java.util.Set<java.lang.annotation.Annotation> getFieldAnnotations()
public <T extends java.lang.annotation.Annotation> T getFieldAnnotation(java.lang.Class<T> annotationClass)
T
- annotationClass
- the annotation we are looking forpublic java.util.Set<java.lang.annotation.Annotation> getPropertyAnnotations()
public <T extends java.lang.annotation.Annotation> T getPropertyAnnotation(java.lang.Class<T> annotationClass)
public java.lang.String getPropertyName()
public final boolean isPropertyAware()
true
when this node represents a bean property and can therefore be queried for property
specific information like annotations or property types. But there will also be nodes that represent collection
items, map entries, etc. In those cases this method will return false
.public final boolean isRootNode()
public final boolean isIgnored()
getState()
== DiffNode.State.IGNORED
@Deprecated public boolean isExcluded()
public final java.util.Set<java.lang.String> getCategories()
Set
of String
with the categories of this node.Set
of String
with the categories of this nodepublic DiffNode getParentNode()
protected final void setParentNode(DiffNode parentNode)
parentNode
- The parent of this node. May be null, if this is a root node.public java.lang.Object get(java.lang.Object target)
public void set(java.lang.Object target, java.lang.Object value)
public void unset(java.lang.Object target)
public java.lang.Object canonicalGet(java.lang.Object target)
public void canonicalSet(java.lang.Object target, java.lang.Object value)
public void canonicalUnset(java.lang.Object target)
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object o)
equals
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object
public void addCategories(java.util.Collection<java.lang.String> additionalCategories)
public NodePath getCircleStartPath()
isCircular()
returns true
.public void setCircleStartPath(NodePath circularStartPath)
public DiffNode getCircleStartNode()
public void setCircleStartNode(DiffNode circleStartNode)