|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.util.Path
public final class Path
A path is a description of the position of some resource. A path consists
of segments where a segment can be any kind of string (preferably a segment is a
valid java-identifier). A path can be converted into a string, the segments will
be encoded
when doing that.
Field Summary | |
---|---|
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 Summary | |
---|---|
Path()
Creates a new root path. |
|
Path(String... segments)
Creates a new path with the given segments. |
|
Path(String path)
Creates a new path. |
Method Summary | |
---|---|
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 . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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 information
public static final Path TYPE_MODIFIER_MASK_PATH
ModifierMask
public static final Path TYPE_STRING_CHOICE_PATH
String
as value and a Choice
as information
public static final Path TYPE_LABEL
Constructor Detail |
---|
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.Method Detail |
---|
public static String encodeSegment(String segment)
segment
, thus
creating a valid segment.
segment
- the segment to encode
public static String decodeSegment(String segment)
encodeSegment(String)
.
segment
- some segment with escape characters
public static boolean isValidPath(String path)
path
is a valid path or not
path
- the path to test
true
if the segment is validpublic int getSegmentCount()
public String getSegment(int index)
index
'th segment of this path.
index
- the location of the segment
public 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 1
public Path append(Path path)
this
and path
.
path
- the path to add
public 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 path
public Path append(String segments)
segments
to this path.
segments
- the additional segments
public Path getParent()
null
if this is the rootpublic boolean startsWith(Path path)
Path
matches
the segments of path
.
path
- some other path
true
if this path is either equal to path
or
if this path starts with path
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |