public final class Path
extends java.lang.Object
encoded
when doing that.Modifier and Type | Field and Description |
---|---|
static Path |
TYPE_BOOLEAN_PATH
standard path for
Boolean |
static Path |
TYPE_INT_PATH
standard path for
Integer |
static Path |
TYPE_KEYSTROKE_PATH
standard path for
KeyStroke , can use KeyStrokeValidator as information |
static Path |
TYPE_LABEL
standard path for a label, a label is not shown in an enabled editor
|
static Path |
TYPE_MODIFIER_MASK_PATH
standard path for
ModifierMask |
static Path |
TYPE_STRING_CHOICE_PATH
standard path for a choice using a
String as value and a Choice as information |
static Path |
TYPE_STRING_PATH
standard path for
String |
Constructor and Description |
---|
Path()
Creates a new root path.
|
Path(java.lang.String... segments)
Creates a new path with the given segments.
|
Path(java.lang.String path)
Creates a new path.
|
Modifier and Type | Method and Description |
---|---|
Path |
append(Path path)
Creates a new path which is a combination of
this and path . |
Path |
append(java.lang.String segments)
Creates a new path appending
segments to this path. |
static java.lang.String |
decodeSegment(java.lang.String segment)
The opposite of
encodeSegment(String) . |
static java.lang.String |
encodeSegment(java.lang.String segment)
Puts an escape character before any illegal character of
segment , thus
creating a valid segment. |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getLastSegment()
Gets the last segment of this path or
null if this is
the root path. |
Path |
getParent()
Returns the parent of this path.
|
java.lang.String |
getSegment(int index)
Gets the
index 'th segment of this path. |
int |
getSegmentCount()
Gets the number of segments of this path.
|
int |
hashCode() |
static boolean |
isValidPath(java.lang.String path)
Tells whether
path is a valid path or not |
boolean |
startsWith(Path path)
Tells whether the first segments of this
Path matches
the segments of path . |
Path |
subPath(int offset,
int length)
Creates a new path that is a subset of this path.
|
java.lang.String |
toString() |
Path |
uniqueAppend(Path path)
Creates a new path which is not only a combination of
this
and path , but is also unique in the way that
x+y.z would not yield the same as x.y+z . |
public static final Path TYPE_INT_PATH
Integer
public static final Path TYPE_STRING_PATH
String
public static final Path TYPE_BOOLEAN_PATH
Boolean
public static final Path TYPE_KEYSTROKE_PATH
KeyStroke
, can use KeyStrokeValidator
as informationpublic static final Path TYPE_MODIFIER_MASK_PATH
ModifierMask
public static final Path TYPE_STRING_CHOICE_PATH
String
as value and a Choice
as informationpublic static final Path TYPE_LABEL
public Path(java.lang.String... segments)
segments
- the pathpublic Path()
public Path(java.lang.String path)
path
- the dot-separated segments of this path, each segment
must be a valid Java-identifier. Note that no segment should start with
"_". Clients may use encodeSegment(String)
to use any character
within a single segment.public static java.lang.String encodeSegment(java.lang.String segment)
segment
, thus
creating a valid segment.segment
- the segment to encodepublic static java.lang.String decodeSegment(java.lang.String segment)
encodeSegment(String)
.segment
- some segment with escape characterspublic static boolean isValidPath(java.lang.String path)
path
is a valid path or notpath
- the path to testtrue
if the segment is validpublic int getSegmentCount()
public java.lang.String getSegment(int index)
index
'th segment of this path.index
- the location of the segmentpublic java.lang.String getLastSegment()
null
if this is
the root path.null
public Path subPath(int offset, int length)
offset
- the begin of the new pathlength
- the length of the new path, at least 1public Path append(Path path)
this
and path
.path
- the path to addpublic Path uniqueAppend(Path path)
this
and path
, but is also unique in the way that
x+y.z
would not yield the same as x.y+z
. This
implies also that (x+y)+z
would result in another path
than x+(y+z)
. Note that the result of this method differs
from append(Path)
. Note also that the new path has a different
prefix than this
.path
- the additional pathpublic Path append(java.lang.String segments)
segments
to this path.segments
- the additional segmentspublic Path getParent()
null
if this is the rootpublic boolean startsWith(Path path)
Path
matches
the segments of path
.path
- some other pathtrue
if this path is either equal to path
or
if this path starts with path
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object