|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectconsciouscode.seedling.NodePath
public final class NodePath
An immutable, abstract path identifying components within a Seedling container.
A Seedling path consists of a sequence of parts, each of which represents the name of a component within the container. The sequence denotes a traversal through successive branches in the hierarchy: each part denotes a child of the previous branch.
Paths can be represented in three ways:
NodePathStrings representing the sequence of parts in the
pathString containing the canonical text form of the
path
A path is either full or partial depending on whether it
starts at a root branch. When represented as an array of strings, a path is
full when it has the string "/" as its first element.
When represented as a single string, a path is full when it starts with the
character '/'.
A special partial path is the identity path which denotes a
traversal that "goes nowhere" within the hierarchy: has no parts.
The canonical text representation of the identity path is ".".
The empty string "" is also parsed into the identity path.
NodePaths are immutable and safe for use by multiple threads.
| Field Summary | |
|---|---|
static NodePath |
IDENTITY_PATH
A partial path that denotes an identity traversal from some unspecified point in the Seedling container to itself. |
static String |
IDENTITY_PATH_STRING
The canonical representation of the identity path. |
static String |
ROOT_NAME
The name of every root node. |
static NodePath |
ROOT_PATH
A full path to the local root node. |
static String |
ROOT_PATH_STRING
The canonical representation of the root path. |
| Method Summary | |
|---|---|
void |
appendTo(Appendable out)
Appends the canonical text representation of this path to the given output stream. |
NodePath |
child(String name)
Builds a path to a child node, extending this path. |
boolean |
equals(Object obj)
|
static NodePath |
forParts(String... parts)
Builds an object representation of a path from it's constituent parts: a sequence of node names. |
static NodePath |
forPath(String path)
Builds an object representation of a path from it's canonical text form. |
static NodePath |
fromParts(String... parts)
Deprecated. Renamed to forParts(java.lang.String...). |
static NodePath |
fromPath(String path)
Deprecated. Renamed to forPath(String). |
String |
getNodeName()
Gets the name of the node identified by this path. |
String[] |
getParts()
Gets the individual parts of this path. |
int |
hashCode()
|
boolean |
isFull()
Determines whether this path is full. |
static boolean |
isFull(String... parts)
Determines whether a given path is full. |
static boolean |
isFull(String path)
Determines whether a given path is full. |
boolean |
isIdentity()
Determines whether this path is the identity path denoting a go-nowhere traversal. |
boolean |
isRoot()
Determines whether this path is the full path denoting the local root. |
NodePath |
parts(String... parts)
Builds a path to a descendant node, from a sequence of path parts. |
NodePath |
path(NodePath path)
Builds a path extending this one. |
NodePath |
path(String path)
Builds a path to a descendant node, parsing the given path into its parts. |
static String[] |
toParts(String path)
Parses the canonical text representation of a path into its individual parts. |
String |
toString()
Gets the canonical text representation of this path. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String ROOT_NAME
root node.
public static final String ROOT_PATH_STRING
root path.
public static final NodePath ROOT_PATH
public static final String IDENTITY_PATH_STRING
identity path.
public static final NodePath IDENTITY_PATH
IDENTITY_PATH.getParts().length == 0.
IDENTITY_PATH_STRING| Method Detail |
|---|
public static NodePath forParts(String... parts)
If the first part is "/" then the result is a full path,
otherwise it's a partial path.
parts - the parts of the path.
None of the parts may be null or empty.
NodePath that's equivalent to the given path parts;
IDENTITY_PATH if the given parts array is null or empty.public static NodePath forPath(String path)
path - the path to build, represented in the canonical text form.
NodePath that's equivalent to the given path;
IDENTITY_PATH if the given path is null, empty, or the
IDENTITY_PATH_STRING.@Deprecated public static NodePath fromPath(String path)
forPath(String).
@Deprecated public static NodePath fromParts(String... parts)
forParts(java.lang.String...).
public static boolean isFull(String path)
path - the path to check, represented in the canonical text form.public static boolean isFull(String... parts)
parts - the path to check, represented as a sequence of node names.public static String[] toParts(String path)
path - the path to parse, represented in the canonical text form.
IDENTITY_PATH_STRING.public boolean isFull()
public final boolean isIdentity()
IDENTITY_PATHpublic final boolean isRoot()
ROOT_PATHpublic String[] getParts()
public String getNodeName()
public NodePath child(String name)
name - the name of the child node.
public NodePath path(NodePath path)
path - the extension.
public NodePath path(String path)
path - the canonical text form to be append to this path.
public NodePath parts(String... parts)
parts - the parts of the path to be appended to this path.
None of the parts may be null or empty.
public void appendTo(Appendable out)
throws IOException
out - the output stream; not null.
IOException - if thrown by the output stream.public String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||