r01f.reflection.fluent
Class StaticFieldTypes.StaticFieldTypeGenerics<T>

java.lang.Object
  extended by r01f.reflection.fluent.StaticFieldTypes.StaticFieldTypeGenerics<T>
Type Parameters:
T - the generic type of the field. Usage example:
   // Retrieves the value of the static field "commonPowers"
   List commmonPowers = Reflection.staticField("commonPowers").ofType(new TypeRef>() {}).in(Jedi.class).get();
 
   // Sets the value of the static field "commonPowers"
   List<String> commonPowers = new ArrayList<String>();
   commonPowers.add("jump");
   Reflection.staticField("commonPowers").ofType(new TypeRef>() {}).in(Jedi.class).set(commonPowers);
 
Enclosing class:
StaticFieldTypes

public static class StaticFieldTypes.StaticFieldTypeGenerics<T>
extends java.lang.Object

Static field to access using Java Reflection.


Field Summary
private  java.lang.String _fieldName
           
private  TypeRef<T> _fieldType
           
 
Constructor Summary
StaticFieldTypes.StaticFieldTypeGenerics(java.lang.String fieldName, TypeRef<T> fieldType)
           
 
Method Summary
 FieldInvoker<T> in(java.lang.Class<?> target)
          Returns a new field invoker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_fieldName

private final java.lang.String _fieldName

_fieldType

private final TypeRef<T> _fieldType
Constructor Detail

StaticFieldTypes.StaticFieldTypeGenerics

StaticFieldTypes.StaticFieldTypeGenerics(java.lang.String fieldName,
                                         TypeRef<T> fieldType)
Method Detail

in

public FieldInvoker<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 is null.
ReflectionError - if a static field with a matching name and type cannot be found.