public abstract class TreeLocation extends Object
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 and Description |
|---|
TreeLocation() |
| Modifier and Type | Method and Description |
|---|---|
static TreeLocation |
create(org.apache.jackrabbit.oak.api.Root root)
Equivalent to
create(root, "/") |
static TreeLocation |
create(org.apache.jackrabbit.oak.api.Root root,
String path)
Create a new
TreeLocation instance for the item
at the given path in root. |
static TreeLocation |
create(org.apache.jackrabbit.oak.api.Tree tree)
Create a new
TreeLocation instance for a tree |
abstract boolean |
exists()
|
TreeLocation |
getChild(String name)
Navigate to a child of the given
name. |
abstract String |
getName()
The name of this location
|
abstract TreeLocation |
getParent()
Navigate to the parent or an invalid location for the root of the hierarchy.
|
abstract String |
getPath()
The path of this location
|
org.apache.jackrabbit.oak.api.PropertyState |
getProperty()
Get the underlying
PropertyState for this TreeLocation. |
org.apache.jackrabbit.oak.api.Tree |
getTree()
Get the underlying
Tree for this TreeLocation. |
abstract boolean |
remove()
Remove the underlying item.
|
String |
toString() |
public static TreeLocation create(@Nonnull org.apache.jackrabbit.oak.api.Tree tree)
TreeLocation instance for a treepublic static TreeLocation create(org.apache.jackrabbit.oak.api.Root root, String path)
TreeLocation instance for the item
at the given path in root.public static TreeLocation create(org.apache.jackrabbit.oak.api.Root root)
create(root, "/")@Nonnull public abstract TreeLocation getParent()
TreeLocation for the parent of this location.public abstract boolean exists()
true if the underlying item is available and has not been disconnected.Tree.exists()public abstract boolean remove()
true if the item was removed, false otherwise.@Nonnull public TreeLocation getChild(String name)
name.name - name of the child@CheckForNull public org.apache.jackrabbit.oak.api.Tree getTree()
Tree for this TreeLocation.null.@CheckForNull public org.apache.jackrabbit.oak.api.PropertyState getProperty()
PropertyState for this TreeLocation.null.Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.