Class TreeLocation
java.lang.Object
org.apache.jackrabbit.oak.plugins.tree.TreeLocation
A
TreeLocation denotes a location inside a tree.
It can either refer to a inner node (that is a Tree), to a leaf (that is a
PropertyState) or to an invalid location which refers to neither of the former.
TreeLocation instances provide methods for navigating trees such that navigation
always results in new TreeLocation instances. Navigation never fails. Errors are
deferred until the underlying item itself is accessed. That is, if a TreeLocation
points to an item which does not exist or is unavailable otherwise (i.e. due to access
control restrictions) accessing the tree will return null at this point.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull TreeLocationcreate(@NotNull org.apache.jackrabbit.oak.api.Root root) Equivalent tocreate(root, "/")static @NotNull TreeLocationCreate a newTreeLocationinstance for the item at the givenpathinroot.static @NotNull TreeLocationcreate(@NotNull org.apache.jackrabbit.oak.api.Tree tree) Create a newTreeLocationinstance for atreeabstract booleanexists()Determine whether the underlyingTreeorPropertyStatefor thisTreeLocationis available.@NotNull TreeLocationNavigate to a child of the givenname.abstract @NotNull StringgetName()The name of this locationabstract @NotNull TreeLocationNavigate to the parent or an invalid location for the root of the hierarchy.abstract @NotNull StringgetPath()The path of this location@Nullable org.apache.jackrabbit.oak.api.PropertyStateGet the underlyingPropertyStatefor thisTreeLocation.@Nullable org.apache.jackrabbit.oak.api.TreegetTree()Get the underlyingTreefor thisTreeLocation.abstract booleanremove()Remove the underlying item.toString()
-
Constructor Details
-
TreeLocation
public TreeLocation()
-
-
Method Details
-
create
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree tree) Create a newTreeLocationinstance for atree -
create
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull org.apache.jackrabbit.oak.api.Root root, @NotNull @NotNull String path) Create a newTreeLocationinstance for the item at the givenpathinroot. -
create
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull org.apache.jackrabbit.oak.api.Root root) Equivalent tocreate(root, "/") -
getParent
Navigate to the parent or an invalid location for the root of the hierarchy.- Returns:
- a
TreeLocationfor the parent of this location.
-
exists
public abstract boolean exists()Determine whether the underlyingTreeorPropertyStatefor thisTreeLocationis available.- Returns:
trueif the underlying item is available and has not been disconnected.- See Also:
-
Tree.exists()
-
getName
The name of this location- Returns:
- name
-
getPath
The path of this location- Returns:
- path
-
remove
public abstract boolean remove()Remove the underlying item.- Returns:
trueif the item was removed,falseotherwise.
-
getChild
Navigate to a child of the givenname.- Parameters:
name- name of the child- Returns:
- this default implementation return a non existing location
-
getTree
@Nullable public @Nullable org.apache.jackrabbit.oak.api.Tree getTree()Get the underlyingTreefor thisTreeLocation.- Returns:
- this default implementation return
null.
-
getProperty
@Nullable public @Nullable org.apache.jackrabbit.oak.api.PropertyState getProperty()Get the underlyingPropertyStatefor thisTreeLocation.- Returns:
- this default implementation return
null.
-
toString
-