|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.jqno.equalsverifier.util.FieldAccessor
public class FieldAccessor
Provides reflective access to one field of an object.
Constructor Summary | |
---|---|
FieldAccessor(Object object,
Field field)
Constructor. |
Method Summary | |
---|---|
boolean |
canBeModifiedReflectively()
Determines whether the field can be modified using reflection. |
void |
changeField(PrefabValues prefabValues)
Changes the field's value to something else. |
void |
copyTo(Object to)
Copies field's value to the corresponding field in the specified object. |
void |
defaultField()
Tries to make the field null. |
boolean |
fieldIsFinal()
Returns whether the field is marked with the final modifier. |
boolean |
fieldIsPrimitive()
Returns whether the field is of a primitive type. |
boolean |
fieldIsStatic()
Returns whether the field is marked with the static modifier. |
boolean |
fieldIsTransient()
Returns whether the field is marked with the transient modifier. |
Object |
get()
Tries to get the field's value. |
Field |
getField()
Getter. |
String |
getFieldName()
Getter for the field's name. |
Class<?> |
getFieldType()
Getter for the field's type. |
Object |
getObject()
Getter. |
void |
set(Object value)
Tries to set the field to the specified value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FieldAccessor(Object object, Field field)
object
- The object we want to access.field
- A field of object.Method Detail |
---|
public Object getObject()
public Field getField()
public Class<?> getFieldType()
public String getFieldName()
public boolean fieldIsPrimitive()
public boolean fieldIsFinal()
public boolean fieldIsStatic()
public boolean fieldIsTransient()
public Object get()
ReflectionException
- If the operation fails.public void set(Object value)
value
- The value that the field should get.
ReflectionException
- If the operation fails.public void defaultField()
ReflectionException
- If the operation fails.public void copyTo(Object to)
to
- The object into which to copy the field.
ReflectionException
- If the operation fails.public void changeField(PrefabValues prefabValues)
prefabValues
- If the field is of a type contained within
prefabValues, the new value will be taken from it.
ReflectionException
- If the operation fails.public boolean canBeModifiedReflectively()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |