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 voidbuildPath(@NotNull StringBuilder sb) protected abstract @NotNull AbstractTreecreateChild(@NotNull String name) Factory method for creating child treesbooleanexists()Determine whether this tree has been removed or does not exist otherwise (e.g.@NotNull TreeGet a possibly non existing child of thisTree.Returns the list of child names considering its ordering when theTreeConstants.OAK_CHILD_ORDERproperty is set.All accessible children of thisTreeinstance.longgetChildrenCount(long max) Determine the number of children of thisTreeinstance taking access restrictions into account.protected @NotNull String[]protected abstract @NotNull NodeBuilder@NotNull NodeState@NotNull AbstractTreeprotected abstract @Nullable AbstractTree@NotNull StringgetPath()@NotNull Iterable<? extends PropertyState>All accessible property states.@Nullable PropertyStategetProperty(@NotNull String name) Get a property statelongDetermine the number of properties accessible to the current content session.@Nullable Tree.StatusgetPropertyStatus(@NotNull String name) Get theStatusof a property state ornull.@NotNull Tree.StatusGet theStatusof this tree instance.booleanDetermine if a child of thisTreeinstance exists.protected booleanbooleanhasProperty(@NotNull String name) Determine if a property state exists and is accessible.protected booleanDetermine whether an item should be hidden.booleanisRoot()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
nullfor the root
-
getNodeBuilder
- Returns:
- The
NodeBuilderfor 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:
trueif the item is hidden,falseotherwise.
-
getInternalNodeNames
-
getNodeState
- Returns:
- the underlying
NodeStateof this tree
-
hasOrderableChildren
protected boolean hasOrderableChildren()- Returns:
trueif this tree has orderable children;falseotherwise.
-
getChildNames
Returns the list of child names considering its ordering when theTreeConstants.OAK_CHILD_ORDERproperty is set.- Returns:
- the list of child names.
-
toString
-
isRoot
public boolean isRoot() -
getPath
-
buildPath
-
getStatus
Description copied from interface:TreeGet theStatusof this tree instance. -
exists
public boolean exists()Description copied from interface:TreeDetermine 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:TreeGet a possibly non existing child of thisTree.- Specified by:
getChildin 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:TreeGet a property state- Specified by:
getPropertyin interfaceTree- Parameters:
name- The name of the property state.- Returns:
- the property state with the given
nameornullif no such property state exists or the property is not accessible.
-
hasProperty
Description copied from interface:TreeDetermine if a property state exists and is accessible.- Specified by:
hasPropertyin interfaceTree- Parameters:
name- The name of the property state- Returns:
trueif and only if a property with the givennameexists and is accessible.
-
getPropertyCount
public long getPropertyCount()Description copied from interface:TreeDetermine the number of properties accessible to the current content session.- Specified by:
getPropertyCountin interfaceTree- Returns:
- The number of accessible properties.
-
getPropertyStatus
Description copied from interface:TreeGet theStatusof a property state ornull.- Specified by:
getPropertyStatusin interfaceTree- Parameters:
name- The name of the property state.- Returns:
- The status of the property state with the given
nameornullin no such property state exists or if the name refers to a property that is not accessible.
-
getProperties
Description copied from interface:TreeAll accessible property states. The returnedIterablehas snapshot semantics. That is, it reflect the state of thisTreeinstance at the time of the call. Later changes to this instance are no visible to iterators obtained from the returned iterable.- Specified by:
getPropertiesin interfaceTree- Returns:
- An
Iterablefor all accessible property states.
-
hasChild
Description copied from interface:TreeDetermine if a child of thisTreeinstance 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:TreeDetermine the number of children of thisTreeinstance 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:
getChildrenCountin interfaceTree- Parameters:
max- the maximum value- Returns:
- the number of accessible children.
-
getChildren
Description copied from interface:TreeAll accessible children of thisTreeinstance. The returnedIterablehas snapshot semantics. That is, it reflect the state of thisTreeinstance at the time of the call. Later changes to this instance are not visible to iterators obtained from the returned iterable.- Specified by:
getChildrenin interfaceTree- Returns:
- An
Iterablefor all accessible children
-