Class AbstractTree
java.lang.Object
org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree
- All Implemented Interfaces:
Tree
- Direct Known Subclasses:
AbstractMutableTree
,ImmutableTree
AbstractTree
provides default implementations for most
read methods of Tree
. Furthermore it handles hides hidden
items.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.api.Tree
Tree.Status
-
Field Summary
Fields inherited from interface org.apache.jackrabbit.oak.api.Tree
EMPTY_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
buildPath
(@NotNull StringBuilder sb) protected abstract @NotNull AbstractTree
createChild
(@NotNull String name) Factory method for creating child treesboolean
exists()
Determine whether this tree has been removed or does not exist otherwise (e.g.@NotNull Tree
Get a possibly non existing child of thisTree
.Returns the list of child names considering its ordering when theTreeConstants.OAK_CHILD_ORDER
property is set.All accessible children of thisTree
instance.long
getChildrenCount
(long max) Determine the number of children of thisTree
instance taking access restrictions into account.protected @NotNull String[]
protected abstract @NotNull NodeBuilder
@NotNull NodeState
@NotNull AbstractTree
protected abstract @Nullable AbstractTree
@NotNull String
getPath()
@NotNull Iterable<? extends PropertyState>
All accessible property states.@Nullable PropertyState
getProperty
(@NotNull String name) Get a property statelong
Determine the number of properties accessible to the current content session.@Nullable Tree.Status
getPropertyStatus
(@NotNull String name) Get theStatus
of a property state ornull
.@NotNull Tree.Status
Get theStatus
of this tree instance.boolean
Determine if a child of thisTree
instance exists.protected boolean
boolean
hasProperty
(@NotNull String name) Determine if a property state exists and is accessible.protected boolean
Determine whether an item should be hidden.boolean
isRoot()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.jackrabbit.oak.api.Tree
addChild, getName, orderBefore, remove, removeProperty, setOrderableChildren, setProperty, setProperty, setProperty
-
Constructor Details
-
AbstractTree
public AbstractTree()
-
-
Method Details
-
createChild
@NotNull protected abstract @NotNull AbstractTree createChild(@NotNull @NotNull String name) throws IllegalArgumentException Factory method for creating child trees- Parameters:
name
- name of the child tree- Returns:
- child tree of this tree with the given
name
- Throws:
IllegalArgumentException
- if the given name string is empty or contains the forward slash character
-
getParentOrNull
- Returns:
- the parent of this tree or
null
for the root
-
getNodeBuilder
- Returns:
- The
NodeBuilder
for the underlying node state
-
isHidden
Determine whether an item should be hidden. I.e. not exposed through this tree.- Parameters:
name
- name of an item- Returns:
true
if the item is hidden,false
otherwise.
-
getInternalNodeNames
-
getNodeState
- Returns:
- the underlying
NodeState
of this tree
-
hasOrderableChildren
protected boolean hasOrderableChildren()- Returns:
true
if this tree has orderable children;false
otherwise.
-
getChildNames
Returns the list of child names considering its ordering when theTreeConstants.OAK_CHILD_ORDER
property is set.- Returns:
- the list of child names.
-
toString
-
isRoot
public boolean isRoot() -
getPath
-
buildPath
-
getStatus
Description copied from interface:Tree
Get theStatus
of this tree instance. -
exists
public boolean exists()Description copied from interface:Tree
Determine whether this tree has been removed or does not exist otherwise (e.g. caused by a refresh, rebase or commit) or is not visible due to access control restriction or does not exist at all. -
getParent
-
getChild
@NotNull public @NotNull Tree getChild(@NotNull @NotNull String name) throws IllegalArgumentException Description copied from interface:Tree
Get a possibly non existing child of thisTree
.- Specified by:
getChild
in interfaceTree
- Parameters:
name
- The name of the child to retrieve.- Returns:
- The child with the given
name
. - Throws:
IllegalArgumentException
- if the given name is invalid
-
getProperty
Description copied from interface:Tree
Get a property state- Specified by:
getProperty
in interfaceTree
- Parameters:
name
- The name of the property state.- Returns:
- the property state with the given
name
ornull
if no such property state exists or the property is not accessible.
-
hasProperty
Description copied from interface:Tree
Determine if a property state exists and is accessible.- Specified by:
hasProperty
in interfaceTree
- Parameters:
name
- The name of the property state- Returns:
true
if and only if a property with the givenname
exists and is accessible.
-
getPropertyCount
public long getPropertyCount()Description copied from interface:Tree
Determine the number of properties accessible to the current content session.- Specified by:
getPropertyCount
in interfaceTree
- Returns:
- The number of accessible properties.
-
getPropertyStatus
Description copied from interface:Tree
Get theStatus
of a property state ornull
.- Specified by:
getPropertyStatus
in interfaceTree
- Parameters:
name
- The name of the property state.- Returns:
- The status of the property state with the given
name
ornull
in no such property state exists or if the name refers to a property that is not accessible.
-
getProperties
Description copied from interface:Tree
All accessible property states. The returnedIterable
has snapshot semantics. That is, it reflect the state of thisTree
instance at the time of the call. Later changes to this instance are no visible to iterators obtained from the returned iterable.- Specified by:
getProperties
in interfaceTree
- Returns:
- An
Iterable
for all accessible property states.
-
hasChild
Description copied from interface:Tree
Determine if a child of thisTree
instance exists. If no child exists or an existing child isn't accessible this method returnsfalse
. -
getChildrenCount
public long getChildrenCount(long max) Description copied from interface:Tree
Determine the number of children of thisTree
instance taking access restrictions into account.If an implementation does know the exact value, it returns it (even if the value is higher than max). If the implementation does not know the exact value, and the child node count is higher than max, it may return Long.MAX_VALUE. The cost of the operation is at most O(max).
- Specified by:
getChildrenCount
in interfaceTree
- Parameters:
max
- the maximum value- Returns:
- the number of accessible children.
-
getChildren
Description copied from interface:Tree
All accessible children of thisTree
instance. The returnedIterable
has snapshot semantics. That is, it reflect the state of thisTree
instance at the time of the call. Later changes to this instance are not visible to iterators obtained from the returned iterable.- Specified by:
getChildren
in interfaceTree
- Returns:
- An
Iterable
for all accessible children
-