T
- the generic type of the field.public class StaticFieldTypeRef<T> extends Object
The following is an example of proper usage of this class:
// Retrieves the value of the static field "commonPowers" List<String> commmonPowers =staticField
("commonPowers").ofType
(newTypeRef
<List<String>>() {}).in
(Jedi.class).get
(); // Sets the value of the static field "commonPowers" List<String> commonPowers = new ArrayList<String>(); commonPowers.add("jump");staticField
("commonPowers").ofType
(newTypeRef
<List<String>>() {}).in
(Jedi.class).set
(commonPowers);
public Invoker<T> in(Class<?> target)
target
- the type containing the static field of interest.NullPointerException
- if the given target is null
.ReflectionError
- if a static field with a matching name and type cannot be found.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.