public final class NodePath extends Object
Node within the Model.
Includes methods to manipulate and get information about NodePath's.
Implements value semantics. Instances are immutable.
Implements hashCode() and equals(java.lang.Object) so that instances can be used as
Map keys.
ClassificationNode's except the last one which may be a Module.
In that case the NodePath is said to not be partial (complete). If the last
Node is a ClassificationNode, it is said to be partial. This is similar to
files and directories in a file system, although there is no relation to actual
files and directories.
In general when we talk about a NodePath we mean a non-partial (complete) NodePath that refers to a Module. When a NodePath is partial we make it explicit.
As a convention, ClassificationNode's are named using the PascalCase notation, while Module's are named using the lower-case-with-dashes notation. But this is not a requirement and is not enforced.
Node names can contain characters A - Z, a - z, 0 - 9, - and _. The character . is not allowed. Node names must contain at least 1 character. The first character of a Node name cannot be - (but can be _).
NodePath supports a literal form where "/" is used to separate Node names, as in Domain/SubDomain/System/my-module. A partial NodePath ends with a trailing "/". The empty NodePath literal represents the root ClassificationNode (a partial NodePath). Contrary to other partial NodePath's, it does not end with "/" since this may be confusing as NodePath's never begin with "/". So the empty NodePath literal is a special case.
A NodePath is always absolute, the first Node representing an immediate child of the unnamed root ClassificationNode of the hierarchy. A NodePath does not start with a "/"; emphasis on them being absolute is not deemed necessary.
| Constructor and Description |
|---|
NodePath(NodePath nodePathParent,
String moduleName)
Constructor for a non-partial NodePath using a partial parent NodePath and a
Module name. |
NodePath(NodePath nodePathParent,
String nodeName,
boolean isPartial)
Constructor using a partial parent NodePath and a
Node name. |
NodePath(String stringNodePath)
Constructor using a NodePath literal.
|
NodePath(String[] arrayNodeName)
Constructor for a non-partial NodePath using an array of
Node names. |
NodePath(String[] arrayNodeName,
boolean isPartial)
Constructor using an array of
Node names. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
String[] |
getArrayNodeName() |
String |
getModuleName() |
int |
getNodeCount() |
String |
getNodeName(int index)
Returns the name of a
Node in the NodePath. |
NodePath |
getNodePathParent() |
NodePath |
getNodePathPartial() |
String |
getPropertyNameSegment()
This method behaves in a way very similar to toString, except that '.' is used
to separate node names instead of "/", and no trailing '.' is added at the end,
making the returned String more appropriate for use as part of a property name.
|
int |
hashCode() |
boolean |
isPartial() |
static NodePath |
parse(String stringNodePath)
Parses a NodePath literal.
|
String |
toString() |
public NodePath(String[] arrayNodeName)
Node names.arrayNodeName - Array of Node names.public NodePath(String[] arrayNodeName, boolean isPartial)
Node names.arrayNodeName - Array of Node names.isPartial - Indicates if the NodePath is partial.public NodePath(NodePath nodePathParent, String moduleName)
Module name.nodePathParent - Parent NodePath (partial).moduleName - Module name.public NodePath(NodePath nodePathParent, String nodeName, boolean isPartial)
Node name.nodePathParent - Parent NodePath (partial).nodeName - Node name.isPartial - Indicates if the NodePath is partial.public NodePath(String stringNodePath)
Throws RuntimeException if parsing fails.
stringNodePath - NodePath literal.public static NodePath parse(String stringNodePath) throws ParseException
stringNodePath - NodePath literal.ParseException - If parsing fails.public boolean isPartial()
ClassificationNode as opposed to a Module.public int getNodeCount()
Node's in the NodePath.public String getNodeName(int index)
Node in the NodePath.index - Index of the Node.public NodePath getNodePathParent()
public NodePath getNodePathPartial()
public String getModuleName()
Module name of this NodePath. The NodePath must not be partial.public String getPropertyNameSegment()
Copyright © 2015–2017 AZYVA INC.. All rights reserved.