public final class Path extends 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
|
static Path |
TYPE_STRING_PATH
standard path for
String |
Constructor and Description |
---|
Path()
Creates a new root path.
|
Path(String... segments)
Creates a new path with the given segments.
|
Path(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(String segments)
Creates a new path appending
segments to this path. |
static String |
decodeSegment(String segment)
The opposite of
encodeSegment(String) . |
static String |
encodeSegment(String segment)
Puts an escape character before any illegal character of
segment , thus
creating a valid segment. |
boolean |
equals(Object obj) |
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.
|
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(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.
|
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_KEYSTROKE_PATH
KeyStroke
, can use KeyStrokeValidator
as informationpublic static final Path TYPE_MODIFIER_MASK_PATH
ModifierMask
public static final Path TYPE_STRING_CHOICE_PATH
public static final Path TYPE_LABEL
public Path(String... segments)
segments
- the pathpublic Path()
public Path(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 String encodeSegment(String segment)
segment
, thus
creating a valid segment.segment
- the segment to encodepublic static String decodeSegment(String segment)
encodeSegment(String)
.segment
- some segment with escape characterspublic static boolean isValidPath(String path)
path
is a valid path or notpath
- the path to testtrue
if the segment is validpublic int getSegmentCount()
public String getSegment(int index)
index
'th segment of this path.index
- the location of the segmentpublic 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(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