public class FieldMirror extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BOOL_GETTER_PREFIX
The boolean field getter prefix.
|
static String |
GETTER_PREFIX
The field getter prefix.
|
static String |
SETTER_PREFIX
The field setter prefix.
|
Constructor and Description |
---|
FieldMirror(Field reflectedField)
Public constructor for the reflection class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static String |
getBooleanGetterName(String fieldName)
Get the getter name for a boolean field.
|
ClassMirror<?> |
getDeclaringClass()
Gets the declaring class of the field.
|
MethodMirror |
getGetter()
Gets the getter for the reflected field.
|
static String |
getGetterName(String fieldName)
Get the getter name for a field.
|
Field |
getReflectedField()
Gets the field being reflected.
|
MethodMirror |
getSetter()
Gets the setter for the reflected field.
|
static String |
getSetterName(String fieldName)
Get the setter name for a field.
|
ClassMirror<?> |
getType()
Gets the type (class) of the reflected field.
|
Object |
getValue(Object targetObject,
Boolean fieldAccess,
Boolean ignoreAccess)
Gets the value of a field.
|
int |
hashCode() |
void |
setReflectedField(Field reflectedField)
Sets the field being reflected.
|
void |
setType(ClassMirror<?> type)
Sets the type (class) of the reflected field.
|
void |
setValue(Object targetObject,
Object newValue,
Boolean fieldAccess,
Boolean ignoreAccess)
Sets the value of a field.
|
public static final String GETTER_PREFIX
public static final String BOOL_GETTER_PREFIX
public static final String SETTER_PREFIX
public FieldMirror(Field reflectedField) throws org.dejava.component.exception.localized.unchecked.EmptyParameterException
reflectedField
- Field being reflected.org.dejava.component.exception.localized.unchecked.EmptyParameterException
- If the reflected field is not given.public Field getReflectedField()
public void setReflectedField(Field reflectedField)
reflectedField
- New field being reflected.public ClassMirror<?> getType()
public void setType(ClassMirror<?> type)
type
- New type (class) of the reflected field.public ClassMirror<?> getDeclaringClass()
public static String getGetterName(String fieldName)
fieldName
- The field name.public static String getBooleanGetterName(String fieldName)
fieldName
- The field name.public MethodMirror getGetter() throws org.dejava.component.exception.localized.unchecked.InvalidParameterException
org.dejava.component.exception.localized.unchecked.InvalidParameterException
- If the getter cannot be found.public static String getSetterName(String fieldName)
fieldName
- The field name.public MethodMirror getSetter() throws org.dejava.component.exception.localized.unchecked.InvalidParameterException
org.dejava.component.exception.localized.unchecked.InvalidParameterException
- If the setter cannot be found.public Object getValue(Object targetObject, Boolean fieldAccess, Boolean ignoreAccess) throws org.dejava.component.exception.localized.unchecked.EmptyParameterException, org.dejava.component.exception.localized.unchecked.InvalidParameterException, InvocationException
targetObject
- The target object to get the field value from. Might be null if it is a static field.fieldAccess
- If the field must be accessed directly (or via getter).ignoreAccess
- If the defined access (private or protected) must be ignored.org.dejava.component.exception.localized.unchecked.EmptyParameterException
- If the target object is null and the field/getter is not static.org.dejava.component.exception.localized.unchecked.InvalidParameterException
- If the field/getter cannot be accessed or found.InvocationException
- If the getter for the field throws an exception.public void setValue(Object targetObject, Object newValue, Boolean fieldAccess, Boolean ignoreAccess) throws org.dejava.component.exception.localized.unchecked.EmptyParameterException, org.dejava.component.exception.localized.unchecked.InvalidParameterException, InvocationException
targetObject
- The target object to set the field value. Might be null if it is a static field.newValue
- The new value for the field.fieldAccess
- If the field must be accessed directly (or via setter).ignoreAccess
- If the defined access (private or protected) must be ignored.org.dejava.component.exception.localized.unchecked.EmptyParameterException
- If the target object is null and the field/setter is not static.org.dejava.component.exception.localized.unchecked.InvalidParameterException
- If the field/setter cannot be accessed or found. Or if the new value is invalid.InvocationException
- If the setter for the field throws an exception.public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
Copyright © 2013. All Rights Reserved.