public class DocumentPath extends Object implements Comparable<DocumentPath>
DocumentTree.| Modifier and Type | Field and Description | 
|---|---|
static String | 
DEFAULT_SEPARATOR
Default path separator. 
 | 
static String | 
DEFAULT_SEPARATOR_RE
Default path separator regex. 
 | 
static DocumentPath | 
ROOT
Root document tree path. 
 | 
| Constructor and Description | 
|---|
DocumentPath(String nodeName,
            DocumentPath parentPath)
Constructs a new document path. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
DocumentPath | 
append(List<String> childElms)
Creates a new DocumentPath element appending  
childElm to
 this path. | 
DocumentPath | 
childPath()
Returns the relative  path to the given node. 
 | 
int | 
compareTo(DocumentPath that)  | 
boolean | 
equals(Object obj)  | 
static DocumentPath | 
from(List<String> elements)
Creates a new  
DocumentPath from a list of path elements. | 
static DocumentPath | 
from(List<String> elements,
    String... childElms)
Creates a new  
DocumentPath from a list of path elements. | 
static DocumentPath | 
from(List<String> elements,
    String child)
Creates a new  
DocumentPath from a list of path elements. | 
static DocumentPath | 
from(String... elements)
Creates a new  
DocumentPath from a list of path elements. | 
static DocumentPath | 
from(String path)
Creates a new  
DocumentPath from a period delimited path string. | 
int | 
hashCode()  | 
boolean | 
isAncestorOf(DocumentPath other)
Returns if the specified path belongs to a direct ancestor of the node pointed at by this path. 
 | 
boolean | 
isDescendentOf(DocumentPath other)
Returns if the specified path is belongs to a subtree rooted this path. 
 | 
static DocumentPath | 
leastCommonAncestor(Collection<DocumentPath> paths)
Returns the path that points to the least common ancestor of the specified
 collection of paths. 
 | 
DocumentPath | 
parent()
Returns a path for the parent of this node. 
 | 
List<String> | 
pathElements()
Returns the list of path elements representing this path in correct
 order. 
 | 
String | 
toString()  | 
public static final String DEFAULT_SEPARATOR
public static final String DEFAULT_SEPARATOR_RE
public static final DocumentPath ROOT
public DocumentPath(String nodeName, DocumentPath parentPath)
 New paths must contain at least one name and string names MUST NOT contain
 any path separator characters.
 If one field is null that field will be ignored.
nodeName - the name of the last level of this pathparentPath - the path representing the parent leading up to this
                   node, in the case of the root this should be nullIllegalDocumentNameException - if both parameters are null or name contains an illegal character ('.')public static DocumentPath from(String path)
DocumentPath from a period delimited path string.path - path stringDocumentPath instancepublic static DocumentPath from(String... elements)
DocumentPath from a list of path elements.elements - path elementsDocumentPath instancepublic static DocumentPath from(List<String> elements)
DocumentPath from a list of path elements.elements - path elementsDocumentPath instancepublic static DocumentPath from(List<String> elements, String child)
DocumentPath from a list of path elements.elements - path elementschild - child elementDocumentPath instancepublic static DocumentPath from(List<String> elements, String... childElms)
DocumentPath from a list of path elements.elements - path elementschildElms - child elementDocumentPath instancepublic DocumentPath append(List<String> childElms)
childElm to
 this path.childElms - to appendpublic DocumentPath childPath()
public DocumentPath parent()
null.public List<String> pathElements()
public boolean isAncestorOf(DocumentPath other)
 Example: root.a is a direct ancestor of r.a.b.c; while r.a.x is not.
other - other pathtrue is yes; false otherwise.public boolean isDescendentOf(DocumentPath other)
 Example: root.a.b and root.a.b.c.d.e are descendants of r.a.b;
 while r.a.x.c is not.
other - other pathtrue is yes; false otherwise.public static DocumentPath leastCommonAncestor(Collection<DocumentPath> paths)
paths - collection of pathpublic int compareTo(DocumentPath that)
compareTo in interface Comparable<DocumentPath>