|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.util.reflect.POJOFieldAccessor
public class POJOFieldAccessor
Constructor Summary | |
---|---|
POJOFieldAccessor(java.lang.Class clazz,
java.lang.String property)
Instantiates a field accessor for a property of a given POJO. |
|
POJOFieldAccessor(java.lang.reflect.Field field)
Instantiates a field accessor for a field of a given POJO. |
|
POJOFieldAccessor(java.lang.reflect.Method getter)
Instantiates a field accessor for a property of a given POJO specified through the supplied getter method. |
Method Summary | ||
---|---|---|
boolean |
checkMandatory()
Parse all relevant Annotations and try to retrieve a Column
-Annotation and test it's nullable() value. |
|
boolean |
checkUpdatable()
Parse all relevant Annotations and try to retrieve a Column
-Annotation and test it's updatable() value. |
|
|
getAnnotation(java.lang.Class<T> type)
|
|
java.lang.annotation.Annotation[] |
getAnnotations()
|
|
java.lang.Class |
getDeclaringClass()
|
|
FieldAccessor |
getIdAccessor()
Get the accessor used to access the ID-Field of the same POJO this FieldAccessor belongs to. |
|
java.lang.String |
getName()
|
|
java.lang.Class |
getType()
|
|
java.lang.Object |
getValueOf(java.lang.Object pojo)
Gets the associated field value of the given instance of the underlying class. |
|
void |
setIdAccessor(FieldAccessor idAccessor)
Set the accessor used to access the ID-Field of the same POJO this FieldAccessor belongs to. |
|
void |
setValueOn(java.lang.Object pojo,
java.lang.Object value)
Sets the associated field value on the given instance of the underlying class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public POJOFieldAccessor(java.lang.reflect.Field field)
public POJOFieldAccessor(java.lang.Class clazz, java.lang.String property) throws java.lang.NoSuchMethodException, java.lang.SecurityException
clazz
- The class for which to access the propertyproperty
- The property name to access.
java.lang.NoSuchMethodException
- If no getter for the given property is found.
java.lang.SecurityException
- If the security context does not allow access to the getter.public POJOFieldAccessor(java.lang.reflect.Method getter) throws java.lang.NoSuchMethodException
clazz
- The class for which to access the propertyproperty
- The property name to access.
java.lang.NoSuchMethodException
- If the supplied method is not valid getter method.Method Detail |
---|
public java.lang.Object getValueOf(java.lang.Object pojo) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
FieldAccessor
getValueOf
in interface FieldAccessor
pojo
- The object of which to get the field value.
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public void setValueOn(java.lang.Object pojo, java.lang.Object value) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
FieldAccessor
setValueOn
in interface FieldAccessor
pojo
- The object on which to set the field value.value
- The value of the associated field.
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> type)
getAnnotation
in interface FieldAccessor
type
- The annotation type to request for.
public java.lang.annotation.Annotation[] getAnnotations()
getAnnotations
in interface FieldAccessor
public java.lang.String getName()
getName
in interface FieldAccessor
public java.lang.Class getType()
getType
in interface FieldAccessor
public java.lang.Class getDeclaringClass()
getDeclaringClass
in interface FieldAccessor
public boolean checkMandatory()
FieldAccessor
Column
-Annotation and test it's nullable()
value.
checkMandatory
in interface FieldAccessor
true
for primitives,(!Column.nullable())
if a Column
-Annotation could be found,false
otherwise.public boolean checkUpdatable()
FieldAccessor
Column
-Annotation and test it's updatable()
value.
checkUpdatable
in interface FieldAccessor
true
for primitives,Column.updatable()
if a Column
-Annotation could be found,true
otherwise.public void setIdAccessor(FieldAccessor idAccessor)
FieldAccessor
FieldAccessor
belongs to.
setIdAccessor
in interface FieldAccessor
idAccessor
- The FieldAccessor
for the ID-Field.public FieldAccessor getIdAccessor()
FieldAccessor
FieldAccessor
belongs to.
getIdAccessor
in interface FieldAccessor
FieldAccessor
for the ID-Field (may be null).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |