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