Class TreeLocation
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.tree.TreeLocation
-
public abstract class TreeLocation extends java.lang.ObjectATreeLocationdenotes a location inside a tree.It can either refer to a inner node (that is a
Tree), to a leaf (that is aPropertyState) or to an invalid location which refers to neither of the former.TreeLocationinstances provide methods for navigating trees such that navigation always results in newTreeLocationinstances. Navigation never fails. Errors are deferred until the underlying item itself is accessed. That is, if aTreeLocationpoints to an item which does not exist or is unavailable otherwise (i.e. due to access control restrictions) accessing the tree will returnnullat this point.
-
-
Constructor Summary
Constructors Constructor Description TreeLocation()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static @NotNull TreeLocationcreate(@NotNull Root root)Equivalent tocreate(root, "/")static @NotNull TreeLocationcreate(@NotNull Root root, @NotNull java.lang.String path)Create a newTreeLocationinstance for the item at the givenpathinroot.static @NotNull TreeLocationcreate(@NotNull Tree tree)Create a newTreeLocationinstance for atreeabstract booleanexists()@NotNull TreeLocationgetChild(java.lang.String name)Navigate to a child of the givenname.abstract @NotNull java.lang.StringgetName()The name of this locationabstract @NotNull TreeLocationgetParent()Navigate to the parent or an invalid location for the root of the hierarchy.abstract @NotNull java.lang.StringgetPath()The path of this location@Nullable PropertyStategetProperty()Get the underlyingPropertyStatefor thisTreeLocation.@Nullable TreegetTree()Get the underlyingTreefor thisTreeLocation.abstract booleanremove()Remove the underlying item.java.lang.StringtoString()
-
-
-
Method Detail
-
create
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull Tree tree)
Create a newTreeLocationinstance for atree
-
create
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull Root root, @NotNull @NotNull java.lang.String path)
Create a newTreeLocationinstance for the item at the givenpathinroot.
-
create
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull Root root)
Equivalent tocreate(root, "/")
-
getParent
@NotNull public abstract @NotNull TreeLocation 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()
- Returns:
trueif the underlying item is available and has not been disconnected.- See Also:
Tree.exists()
-
getName
@NotNull public abstract @NotNull java.lang.String getName()
The name of this location- Returns:
- name
-
getPath
@NotNull public abstract @NotNull java.lang.String 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
@NotNull public @NotNull TreeLocation getChild(java.lang.String name)
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 Tree getTree()
Get the underlyingTreefor thisTreeLocation.- Returns:
- this default implementation return
null.
-
getProperty
@Nullable public @Nullable PropertyState getProperty()
Get the underlyingPropertyStatefor thisTreeLocation.- Returns:
- this default implementation return
null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-