|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.fieldvalue.FieldPath
public class FieldPath
The FieldPath class is an object representation of a dotted fieldPath. A String such as "foo.bar.baz" can be used to access a value on a target object using the FieldValue interface. Such a string might be the equivalent of the following Java code: target.getFoo().getBar().getBaz();. In order to avoid reparsing this string each time its used, the FieldPath object provides a way to store the parsed version of this string as a linked list of three nodes "foo"->"bar"->"baz".
In addition to avoiding the need to reparse the dotted fieldPath each time,
we also use the FieldPath object as a place to store the previous
FieldValueAccessor to which the node's fieldName resolved. Of course, the
class for which the previousAccessor applies my not apply for the next usage,
but in the common case it does, and so the performance of the dispatch
operation is improved by avoiding a more costly hash lookup. Finally, the
underlying Accessor (e.g. ReflectionFieldAccessor
or
ReflectionMethodAccessor
) may itself cache a byte-code compiled accesor
for the target, thereby turning field access into a no-lookup, no-reflection
direct access.
Field Summary | |
---|---|
java.lang.String |
_fieldName
|
FieldPath |
_nextFieldPath
|
FieldValueGetter |
_previousGetter
|
FieldValueSetter |
_previousSetter
|
Constructor Summary | |
---|---|
FieldPath(java.lang.String fieldPathString)
Constructs a new FieldPath from fieldPathString. |
Method Summary | |
---|---|
java.lang.String |
car()
Returns the fieldName value of the first node of a linked list of FieldPaths. |
FieldPath |
cdr()
Returns the remainder of the linked list of FieldPaths. |
java.lang.String |
fieldPathString()
Reconstitutes the dotted fieldPath starting at the current node and proceding to the end of the list. |
java.lang.Object |
getFieldValue(java.lang.Object target)
Looks up the FieldValue classExtension for target and forwards to the corresponding method in that classExtension. |
void |
setFieldValue(java.lang.Object target,
java.lang.Object value)
Convenience that avoids the use of the FieldValue class. |
static FieldPath |
sharedFieldPath(java.lang.String fieldPathString)
Attempts to locate a shared instance of a FieldPath object that corresponds to fieldPathString. |
FieldPath |
tail()
Returns the last node in the linked list of FieldPath nodes. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final java.lang.String _fieldName
public final FieldPath _nextFieldPath
public FieldValueSetter _previousSetter
public FieldValueGetter _previousGetter
Constructor Detail |
---|
public FieldPath(java.lang.String fieldPathString)
fieldPathString
- the string which contains a fieldName or
series or fieldNames separated by a FieldPathSeparator.Method Detail |
---|
public static FieldPath sharedFieldPath(java.lang.String fieldPathString)
fieldPathString
- the string which contains a fieldName or
series or fieldNames separated by a FieldPathSeparator.
public java.lang.String car()
public FieldPath cdr()
public FieldPath tail()
public java.lang.String fieldPathString()
public java.lang.String toString()
toString
in class java.lang.Object
public void setFieldValue(java.lang.Object target, java.lang.Object value)
target
- see the FieldPath version of this methodvalue
- see the FieldPath version of this methodpublic java.lang.Object getFieldValue(java.lang.Object target)
target
- see the FieldPath version of this method
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |