Package org.fest.reflect.field
Class StaticFieldType<T>
- java.lang.Object
-
- org.fest.reflect.field.StaticFieldType<T>
-
- Type Parameters:
T- the generic type of the field.
public class StaticFieldType<T> extends java.lang.ObjectUnderstands the type of a static field to access using Java Reflection.The following is an example of proper usage of this class:
// 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 3staticField("count").ofType(int.class).in(Person.class).set(3);- Author:
- Alex Ruiz
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Invoker<T>in(java.lang.Class<?> target)Returns a new field invoker.
-
-
-
Method Detail
-
in
public Invoker<T> in(java.lang.Class<?> target)
Returns a new field invoker. A field invoker is capable of accessing (read/write) the underlying field.- Parameters:
target- the type containing the static field of interest.- Returns:
- the created field invoker.
- Throws:
java.lang.NullPointerException- if the given target isnull.ReflectionError- if a static field with a matching name and type cannot be found.
-
-