|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PojoPath
A PojoPath is a String that acts as expression to
navigate (traverse) the object-web spanned by an
initial Pojo reflectively.
As part of the API this interface is mainly used for documentation of what a
PojoPath is all about. For the API-user a PojoPath is just a
String with a specific syntax and semantic.
PojoPath is defined as follows:PojoPath = «Segment» | «PojoPath».«Segment»
Segment = «Property» | «Index» | «Function»
Property = [a-zA-Z][^.]*Index = [0-9]+Function = @[^.]+Pojo.
Pojo is a
Map, the «Property» is the key to
get and
set the value.name of a property of the actual Pojo. If
the actual Pojo does NOT have such property,
the PojoPath will be illegal and cause a PojoPathException.Integer that represents the position of an
ordered container.Pojo is an array, the
«Index» represents the array-index to access a contained value.Pojo is a
List, the «Index» is used as the list-index to
get and
set a value.PojoPathFunction.
prefix '@' and is followed
by the name of the
function. PojoPathFunction can make assumptions on the actual
Pojo they operate on. If the actual
Pojo does NOT follow these assumptions the
PojoPath will be illegal and cause a PojoPathException.PojoPath-strings path1 and
path2 and for
Object pojo;
PojoPathNavigator navigator;
PojoPathMode mode;
PojoPathContext context;
Object result = navigator.get(pojo, path1, mode, context);
result = navigator.get(result, path2, mode, context);
will produce the same result as:
String path = path1 + "." + path2;
result = navigator.get(pojo, path, mode, context);
| Initial Pojo | PojoPath |
Get-Code |
|---|---|---|
Object object |
class | object.getClass() |
String string |
bytes | string.getBytes() |
Object[] array |
0 | array[0] |
List list |
0 | list.get(0) |
Map map |
key | map.get("key") |
Throwable t |
cause.cause.message.bytes.0 | t.getCause().getCause().getMessage().getBytes()[0] |
| Field Summary | |
|---|---|
static char |
SEPARATOR
The character that separates the segments of a
PojoPath. |
| Method Summary | |
|---|---|
String |
getFunction()
This method gets the name of the function given by the segment or null if it is no function. |
Integer |
getIndex()
This method gets the index given by the segment or null if it is no index. |
String |
getParentPath()
This method gets the parent-path of this PojoPath. |
String |
getPojoPath()
This method gets the actual PojoPath represented by this object. |
String |
getSegment()
This method gets the last segment of this current PojoPath. |
| Field Detail |
|---|
static final char SEPARATOR
segments of a
PojoPath. The value (46 ) will never change.
It is NOT necessary to use this constant to construct a PojoPath.
| Method Detail |
|---|
String getPojoPath()
PojoPath represented by this object.
PojoPath.String getParentPath()
PojoPath."foo.bar.property" then this
method would return "foo.bar".
null if this is the root-segment.String getSegment()
PojoPath. E.g. if
this path represents "foo.bar.property" then this method would
return "property".
Integer getIndex()
segment or null if it is no index.List).segment starts with a Latin digit, it is treated
as index and has to be a
valid integer-value. However parsing
should be done when this object is constructed and therefore this method
should never cause an exception.
segment or
null if it is no index.String getFunction()
segment or null if it is no function.identifies a
PojoPathFunction that will be used to evaluate the
segment.segment starts with the character
PojoPathFunction.FUNCTION_NAME_PREFIX ('@'), it is
treated as function.
segment excluding the first character or
null if the segment does NOT
start with PojoPathFunction.FUNCTION_NAME_PREFIX.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||