public abstract class TreeLocation
extends java.lang.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 @NotNull TreeLocation |
create(@NotNull Root root)
Equivalent to
create(root, "/") |
static @NotNull TreeLocation |
create(@NotNull Root root,
@NotNull java.lang.String path)
Create a new
TreeLocation instance for the item
at the given path in root . |
static @NotNull TreeLocation |
create(@NotNull Tree tree)
Create a new
TreeLocation instance for a tree |
abstract boolean |
exists()
|
@NotNull TreeLocation |
getChild(java.lang.String name)
Navigate to a child of the given
name . |
abstract @NotNull java.lang.String |
getName()
The name of this location
|
abstract @NotNull TreeLocation |
getParent()
Navigate to the parent or an invalid location for the root of the hierarchy.
|
abstract @NotNull java.lang.String |
getPath()
The path of this location
|
@Nullable PropertyState |
getProperty()
Get the underlying
PropertyState for this TreeLocation . |
@Nullable Tree |
getTree()
Get the underlying
Tree for this TreeLocation . |
abstract boolean |
remove()
Remove the underlying item.
|
java.lang.String |
toString() |
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull Tree tree)
TreeLocation
instance for a tree
@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull Root root, @NotNull @NotNull java.lang.String path)
TreeLocation
instance for the item
at the given path
in root
.@NotNull public static @NotNull TreeLocation create(@NotNull @NotNull Root root)
create(root, "/")
@NotNull public abstract @NotNull 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()
@NotNull public abstract @NotNull java.lang.String getName()
@NotNull public abstract @NotNull java.lang.String getPath()
public abstract boolean remove()
true
if the item was removed, false
otherwise.@NotNull public @NotNull TreeLocation getChild(java.lang.String name)
name
.name
- name of the child@Nullable public @Nullable Tree getTree()
Tree
for this TreeLocation
.null
.@Nullable public @Nullable PropertyState getProperty()
PropertyState
for this TreeLocation
.null
.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved