public class NodePath extends Object implements Iterable<String>, Comparable<NodePath>, Serializable
Modifier and Type | Method and Description |
---|---|
NodePath |
append(NodePath path)
Adds the specified path to the end of this path
|
NodePath |
append(String... elements)
Adds the specified elements to the end of this path
|
String[] |
asArray()
Returns the path as an array of strings
|
List<String> |
asList()
Returns the path as an unmodifiable list of strings.
|
int |
compareTo(NodePath other) |
boolean |
equals(Object o) |
static NodePath |
fromString(String path)
Creates a node path with a value represented by the specified path (for example '/home/node1')
|
String |
getLastSegment()
Returns the last part of the path
|
String |
getSegment(int index)
Returns the part of the path at the specified index
|
int |
hashCode() |
boolean |
isParent(NodePath path)
Returns true if this path is an ancestor of the specified path
|
Iterator<String> |
iterator() |
NodePath |
parent()
Returns the path to the parent
|
static NodePath |
path(String... elements)
Creates a node path with the value of the specified elements
|
static NodePath |
root()
Returns the path to the root node
|
int |
size()
Returns the size of the path
|
NodePath |
subPath(int fromIndex)
Returns the sub-path starting at fromIndex
|
NodePath |
subPath(int fromIndex,
int toIndex)
Returns the sub-path starting at fromIndex and ending at toIndex
|
String |
toString() |
public static NodePath path(String... elements)
elements
- the path elementspublic static NodePath root()
public static NodePath fromString(String path)
path
- the string representation of a pathpublic NodePath append(String... elements)
elements
- the elements to appendpublic NodePath append(NodePath path)
path
- the path to appendpublic NodePath subPath(int fromIndex)
fromIndex
- the start of the sub-pathpublic NodePath subPath(int fromIndex, int toIndex)
fromIndex
- the start of the sub-pathtoIndex
- the end of the sub-pathpublic String getSegment(int index)
index
- the indexpublic String getLastSegment()
public NodePath parent()
public boolean isParent(NodePath path)
path
- the pathpublic int size()
public List<String> asList()
public String[] asArray()
public int compareTo(NodePath other)
compareTo
in interface Comparable<NodePath>
Copyright © 2013 JBoss by Red Hat. All Rights Reserved.