public abstract class AbstractDecoratedNodeState extends AbstractNodeState
Modifier and Type | Method and Description |
---|---|
@NotNull NodeBuilder |
builder()
The AbstractDecoratedNodeState implementation returns a ReadOnlyBuilder, which
will fail for any mutable operation.
|
boolean |
compareAgainstBaseState(NodeState base,
NodeStateDiff diff)
Generic default comparison algorithm that simply walks through the
property and child node lists of the given base state and compares
the entries one by one with corresponding ones (if any) in this state.
|
boolean |
equals(java.lang.Object other)
Note that any implementation-specific optimizations of wrapped NodeStates
will not work if a AbstractDecoratedNodeState is passed into their
#equals()
method. |
boolean |
exists()
Checks whether this node exists.
|
@NotNull NodeState |
getChildNode(@NotNull java.lang.String name)
Returns the named, possibly non-existent, child node.
|
@NotNull java.lang.Iterable<? extends ChildNodeEntry> |
getChildNodeEntries()
Returns the iterable child node entries of this instance.
|
NodeState |
getDelegate() |
@NotNull java.lang.Iterable<? extends PropertyState> |
getProperties()
Returns an iterable of the properties of this node.
|
@Nullable PropertyState |
getProperty(@NotNull java.lang.String name)
Returns the named property, or
null if no such property exists. |
boolean |
hasChildNode(@NotNull java.lang.String name)
Checks whether the named child node exists.
|
checkValidName, compareAgainstBaseState, comparePropertiesAgainstBaseState, equals, getBoolean, getBoolean, getChildNodeCount, getChildNodeNames, getLong, getLong, getName, getName, getNames, getNames, getPropertyCount, getString, getString, getStrings, getStrings, hashCode, hasProperty, isValidName, toString, toString
public NodeState getDelegate()
@NotNull public @NotNull NodeBuilder builder()
public boolean exists()
NodeState
true
if this node exists, false
if notpublic boolean hasChildNode(@NotNull @NotNull java.lang.String name)
NodeState
getChildNode(name).exists()
, except that
passing an invalid name as argument will result in a false
return value instead of an IllegalArgumentException
.name
- name of the child nodetrue
if the named child node exists,
false
otherwise@NotNull public @NotNull NodeState getChildNode(@NotNull @NotNull java.lang.String name) throws java.lang.IllegalArgumentException
NodeState
NodeState.exists()
method on the returned child node to determine
whether the node exists or not.name
- name of the child node to returnjava.lang.IllegalArgumentException
- if the given name string is is empty
or contains a forward slash character@NotNull public @NotNull java.lang.Iterable<? extends ChildNodeEntry> getChildNodeEntries()
NodeState
Note on cost and performance: while it is possible to iterate over
all child NodeState
s with the two methods NodeState.getChildNodeNames()
and NodeState.getChildNode(String)
, this method is
considered more efficient because an implementation can potentially
perform the retrieval of the name and NodeState
in one call.
This results in O(n) vs. O(n log n) when iterating over the child node
names and then look up the NodeState
by name.
@Nullable public @Nullable PropertyState getProperty(@NotNull @NotNull java.lang.String name)
NodeState
null
if no such property exists.getProperty
in interface NodeState
getProperty
in class AbstractNodeState
name
- name of the property to returnnull
if not found@NotNull public @NotNull java.lang.Iterable<? extends PropertyState> getProperties()
NodeState
public boolean equals(java.lang.Object other)
#equals()
method. This implementation will compare the wrapped NodeState, however. So
optimizations work when calling #equals()
on a ReportingNodeState.equals
in class AbstractNodeState
other
- Object to compare with this NodeState.public boolean compareAgainstBaseState(NodeState base, NodeStateDiff diff)
AbstractNodeState
compareAgainstBaseState
in interface NodeState
compareAgainstBaseState
in class AbstractNodeState
base
- base statediff
- handler of node state differencestrue
if the full diff was performed, or
false
if it was aborted as requested by the handler
(see the NodeStateDiff
contract for more details)Copyright © 2010 - 2023 Adobe. All Rights Reserved