|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.beanfabrics.Path
public class Path
Immutable representation of a path inside a presentation object model.
Field Summary | |
---|---|
static java.lang.String |
PATH_SEPARATOR
|
static char |
PATH_SEPARATOR_CHAR
|
static java.lang.String |
THIS_PATH_ELEMENT
|
Constructor Summary | |
---|---|
Path()
Creates a new identity ("this") path. |
|
Path(java.lang.String pathStr)
Creates a new path from the given path string. |
Method Summary | |
---|---|
static Path |
concat(Path... paths)
Concatenates the given path objects to a new path. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this path. |
java.lang.String |
getElement(int index)
Returns the element at the specified index. |
java.util.Collection<java.lang.String> |
getElements()
Returns a collection of this path's elements. |
java.lang.String |
getLastElement()
Returns the last element of this path or null if there are
no elements. |
Path |
getParent()
Returns the path to the parent node of this path. |
java.lang.String |
getPathString()
Returns the canonical String representation of this path. |
static java.lang.String |
getPathString(Path path)
Returns the canonical path string of the given path object, or null if the path object is null . |
Path |
getSubPath(int fromPosition)
Returns a new path that is a subpath of this path. |
Path |
getSubPath(int fromPosition,
int length)
Returns a new path that is a subpath of this path. |
int |
hashCode()
Returns the hash code of this path. |
java.util.Iterator<java.lang.String> |
iterator()
Returns an iterator over this path's elements. |
int |
length()
Returns the length of this path. |
static Path |
parse(java.lang.String pathStr)
Returns a Path object that represents a path defined by the given path string, or null if the path string is null . |
static java.lang.String |
toPathString(java.util.List<java.lang.String> listOfStrings)
Concatenates the given strings to a path string delimited by dot '.' |
static java.lang.String |
toPathString(java.lang.String[] strings)
Concatenates the given strings to a path string delimited by dot '.' |
java.lang.String |
toString()
Returns the canonical String representation of this path. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String THIS_PATH_ELEMENT
public static final java.lang.String PATH_SEPARATOR
public static final char PATH_SEPARATOR_CHAR
Constructor Detail |
---|
public Path()
public Path(java.lang.String pathStr) throws java.lang.IllegalArgumentException
pathStr
- a string of path elements delimited by the dot "."
character.
java.lang.IllegalArgumentException
Method Detail |
---|
public Path getParent()
public Path getSubPath(int fromPosition) throws java.lang.IllegalArgumentException
fromPosition
and extends
to the end of this path.
fromPosition
- returned path's first character's position in this
path
java.lang.IllegalArgumentException
public Path getSubPath(int fromPosition, int length) throws java.lang.IllegalArgumentException
fromPosition
and the length of the subpath is
length
.
fromPosition
- returned path's first character's position in this
pathlength
- returned path's number of characters
java.lang.IllegalArgumentException
- thrown if length < 0
or
fromPosition + length > length
public int length()
public java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
public java.util.Collection<java.lang.String> getElements()
public java.lang.String getElement(int index)
index
-
public java.lang.String getLastElement()
null
if there are
no elements.
null
if there are
no elementspublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getPathString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
true
if the obj argument is a Path
and has
the equal elements as this pathpublic static Path parse(java.lang.String pathStr)
null
if the path string is null
.
public static java.lang.String getPathString(Path path)
null
if the path object is null
.
path
-
public static Path concat(Path... paths)
paths
-
public static java.lang.String toPathString(java.util.List<java.lang.String> listOfStrings)
listOfStrings
-
public static java.lang.String toPathString(java.lang.String[] strings)
strings
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |