|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.core.ClassExtension
ariba.util.fieldvalue.FieldValue
ariba.util.fieldvalue.FieldValue_Object
public class FieldValue_Object
The FieldValue_Object class extension is the default implementation of the FieldValue interface. This default implementation is based on java.lang.reflection primitives and will work for essentailly all classes. Of course, certain subclasses may desire to alter the default behavior and, as such, should subclass this class and override the appropriate methods. For example, a Map implementation may want to treat the fieldName as a key for get/put rather than as the name of an instance variable. Some other subclass may desire to mix and match the two approaches. In any case, these special cases should be implemented in subclasses of FieldValue_Object.
Field Summary |
---|
Fields inherited from class ariba.util.fieldvalue.FieldValue |
---|
Getter, Setter |
Fields inherited from class ariba.util.core.ClassExtension |
---|
forClass |
Constructor Summary | |
---|---|
FieldValue_Object()
|
Method Summary | |
---|---|
FieldValueAccessor |
createAccessor(java.lang.Object target,
java.lang.String fieldName,
int type)
Creates and returns a new FieldValueAccessor (by default, a ReflectionFieldValueAccessor) for the given target and fieldName. |
FieldValueAccessor |
getAccessor(java.lang.Object target,
java.lang.String fieldName,
int type)
Maintains a cache of FieldValueAccessor's for the instance by fieldName. |
java.lang.Object |
getFieldValue(java.lang.Object target,
FieldPath fieldPath)
Recursively calls getFieldValuePrimitive() with the head of the fieldPath list. |
java.lang.Object |
getFieldValuePrimitive(java.lang.Object target,
FieldPath fieldPath)
Gets the value from the reveiver using the fieldName indicated by fieldPath -- only the first node of the fieldPath is considered if it is a multi-node path. |
void |
populateFieldInfo(java.lang.Class targetClass,
FieldInfo.Collection collection)
Called by FieldInfo.fieldInfoForClass() to populate FieldInfo.Collection with information on available fields. |
void |
setFieldValue(java.lang.Object target,
FieldPath fieldPath,
java.lang.Object value)
Recursively calls getFieldValuePrimitive() with the head of the fieldPath list up to the last fieldPath node and then calls setFieldValuePrimitive(). |
void |
setFieldValuePrimitive(java.lang.Object target,
FieldPath fieldPath,
java.lang.Object value)
Sets the value on the reveiver using the fieldName indicated by fieldPath -- only the first node of the fieldPath is considered if it is a multi-node path. |
Methods inherited from class ariba.util.fieldvalue.FieldValue |
---|
get, get, getFieldValue, registerClassExtension, setFieldValue |
Methods inherited from class ariba.util.core.ClassExtension |
---|
clone, forClass, getRealClass, setForClass |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FieldValue_Object()
Method Detail |
---|
public FieldValueAccessor createAccessor(java.lang.Object target, java.lang.String fieldName, int type)
createAccessor
in class FieldValue
target
- the object for which the accessor will be createdfieldName
- the name of the field for which the accessor will be createdtype
- the type of accessor will be created (either FieldValue.Setter
or FieldValue.Getter)
public FieldValueAccessor getAccessor(java.lang.Object target, java.lang.String fieldName, int type)
getAccessor
in class FieldValue
target
- the object for which the accessor will be looked upfieldName
- the name of the field for the accessortype
- the type of accessor will be created (either FieldValue.Setter
or FieldValue.Getter)
public void setFieldValuePrimitive(java.lang.Object target, FieldPath fieldPath, java.lang.Object value)
setFieldValuePrimitive
in class FieldValue
target
- the object on which the value will be set for the field identiifed by fieldPathfieldPath
- the fieldPath node (which contains a candidate accessor) to be
used to set the value on target.value
- the value to set on the targetpublic java.lang.Object getFieldValuePrimitive(java.lang.Object target, FieldPath fieldPath)
getFieldValuePrimitive
in class FieldValue
target
- the object from which to get the value of the field identified by fieldPathfieldPath
- the fieldPath node which identifes the field to get.
public void setFieldValue(java.lang.Object target, FieldPath fieldPath, java.lang.Object value)
setFieldValue
in class FieldValue
target
- the object on which to start the recursion for setting
the value using the fieldPathfieldPath
- the linked list of fieldPath nodes used to navigate from
target to the final object in the chain, upon which the value is setvalue
- the value which is set on the final object in the chainpublic java.lang.Object getFieldValue(java.lang.Object target, FieldPath fieldPath)
getFieldValue
in class FieldValue
target
- the first object from which to start the recursion for getting
the value identified by the fieldPath.fieldPath
- the linked list of fieldPath nodes that identifes the value to get
public void populateFieldInfo(java.lang.Class targetClass, FieldInfo.Collection collection)
FieldValue
populateFieldInfo
in class FieldValue
targetClass
- class for which info should be provided.collection
- repository to populate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |