|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fest.reflect.field.Invoker<T>
T - the declared type for the field to access.public final class Invoker<T>
Understands the use of reflection to access a field from an object.
The following is an example of proper usage of this class:
// Retrieves the value of the field "name" String name =field("name").ofType(String.class).in(person).get(); // Sets the value of the field "name" to "Yoda"field("name").ofType(String.class).in(person).set("Yoda"); // Retrieves the value of the static field "count" int count =staticField("count").ofType(int.class).in(Person.class).get(); // Sets the value of the static field "count" to 3field("count").ofType(int.class).in(Person.class).set(3);
| Method Summary | |
|---|---|
T |
get()
Returns the value of the field managed by this class. |
Field |
info()
Returns the "real" field managed by this class. |
void |
set(T value)
Sets a value in the field managed by this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void set(T value)
value - the value to set.
ReflectionError - if the given value cannot be set.public T get()
ReflectionError - if the value of the field cannot be retrieved.public Field info()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||