Package org.onosproject.store.service
Class DocumentPath
- java.lang.Object
- 
- org.onosproject.store.service.DocumentPath
 
- 
- All Implemented Interfaces:
- java.lang.Comparable<DocumentPath>
 
 public class DocumentPath extends java.lang.Object implements java.lang.Comparable<DocumentPath> Unique key for nodes in theDocumentTree.
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringDEFAULT_SEPARATORDefault path separator.static java.lang.StringDEFAULT_SEPARATOR_REDefault path separator regex.static DocumentPathROOTRoot document tree path.
 - 
Constructor SummaryConstructors Constructor Description DocumentPath(java.lang.String nodeName, DocumentPath parentPath)Constructs a new document path.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentPathappend(java.util.List<java.lang.String> childElms)Creates a new DocumentPath element appendingchildElmto this path.DocumentPathchildPath()Returns the relative path to the given node.intcompareTo(DocumentPath that)booleanequals(java.lang.Object obj)static DocumentPathfrom(java.lang.String path)Creates a newDocumentPathfrom a period delimited path string.static DocumentPathfrom(java.lang.String... elements)Creates a newDocumentPathfrom a list of path elements.static DocumentPathfrom(java.util.List<java.lang.String> elements)Creates a newDocumentPathfrom a list of path elements.static DocumentPathfrom(java.util.List<java.lang.String> elements, java.lang.String child)Creates a newDocumentPathfrom a list of path elements.static DocumentPathfrom(java.util.List<java.lang.String> elements, java.lang.String... childElms)Creates a newDocumentPathfrom a list of path elements.inthashCode()booleanisAncestorOf(DocumentPath other)Returns if the specified path belongs to a direct ancestor of the node pointed at by this path.booleanisDescendentOf(DocumentPath other)Returns if the specified path is belongs to a subtree rooted this path.static DocumentPathleastCommonAncestor(java.util.Collection<DocumentPath> paths)Returns the path that points to the least common ancestor of the specified collection of paths.DocumentPathparent()Returns a path for the parent of this node.java.util.List<java.lang.String>pathElements()Returns the list of path elements representing this path in correct order.java.lang.StringtoString()
 
- 
- 
- 
Field Detail- 
DEFAULT_SEPARATORpublic static final java.lang.String DEFAULT_SEPARATOR Default path separator.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SEPARATOR_REpublic static final java.lang.String DEFAULT_SEPARATOR_RE Default path separator regex.- See Also:
- Constant Field Values
 
 - 
ROOTpublic static final DocumentPath ROOT Root document tree path.
 
- 
 - 
Constructor Detail- 
DocumentPathpublic DocumentPath(java.lang.String nodeName, DocumentPath parentPath)Constructs a new document path.New paths must contain at least one name and string names MUST NOT contain any path separator characters. If one field is nullthat field will be ignored.- Parameters:
- nodeName- the name of the last level of this path
- parentPath- the path representing the parent leading up to this node, in the case of the root this should be- null
- Throws:
- IllegalDocumentNameException- if both parameters are null or name contains an illegal character ('.')
 
 
- 
 - 
Method Detail- 
frompublic static DocumentPath from(java.lang.String path) Creates a newDocumentPathfrom a period delimited path string.- Parameters:
- path- path string
- Returns:
- DocumentPathinstance
 
 - 
frompublic static DocumentPath from(java.lang.String... elements) Creates a newDocumentPathfrom a list of path elements.- Parameters:
- elements- path elements
- Returns:
- DocumentPathinstance
 
 - 
frompublic static DocumentPath from(java.util.List<java.lang.String> elements) Creates a newDocumentPathfrom a list of path elements.- Parameters:
- elements- path elements
- Returns:
- DocumentPathinstance
 
 - 
frompublic static DocumentPath from(java.util.List<java.lang.String> elements, java.lang.String child) Creates a newDocumentPathfrom a list of path elements.- Parameters:
- elements- path elements
- child- child element
- Returns:
- DocumentPathinstance
 
 - 
frompublic static DocumentPath from(java.util.List<java.lang.String> elements, java.lang.String... childElms) Creates a newDocumentPathfrom a list of path elements.- Parameters:
- elements- path elements
- childElms- child element
- Returns:
- DocumentPathinstance
 
 - 
appendpublic DocumentPath append(java.util.List<java.lang.String> childElms) Creates a new DocumentPath element appendingchildElmto this path.- Parameters:
- childElms- to append
- Returns:
- this + childElm
 
 - 
childPathpublic DocumentPath childPath() Returns the relative path to the given node.- Returns:
- relative path to the given node.
 
 - 
parentpublic DocumentPath parent() Returns a path for the parent of this node.- Returns:
- parent node path. If this path is for the root, returns null.
 
 - 
pathElementspublic java.util.List<java.lang.String> pathElements() Returns the list of path elements representing this path in correct order.- Returns:
- a list of elements that make up this path
 
 - 
isAncestorOfpublic boolean isAncestorOf(DocumentPath other) Returns if the specified path belongs to a direct ancestor of the node pointed at by this path.Example: root.ais a direct ancestor ofr.a.b.c; whiler.a.xis not.- Parameters:
- other- other path
- Returns:
- trueis yes;- falseotherwise.
 
 - 
isDescendentOfpublic boolean isDescendentOf(DocumentPath other) Returns if the specified path is belongs to a subtree rooted this path.Example: root.a.bandroot.a.b.c.d.eare descendants ofr.a.b; whiler.a.x.cis not.- Parameters:
- other- other path
- Returns:
- trueis yes;- falseotherwise.
 
 - 
leastCommonAncestorpublic static DocumentPath leastCommonAncestor(java.util.Collection<DocumentPath> paths) Returns the path that points to the least common ancestor of the specified collection of paths.- Parameters:
- paths- collection of path
- Returns:
- path to least common ancestor or null if there is nothing in common
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
compareTopublic int compareTo(DocumentPath that) - Specified by:
- compareToin interface- java.lang.Comparable<DocumentPath>
 
 
- 
 
-