r01f.reflection.fluent
Class FieldTypes.FieldTypeGenerics<T>

java.lang.Object
  extended by r01f.reflection.fluent.FieldTypes.FieldTypeGenerics<T>
Type Parameters:
T - the generic type of the field. Usage example:
   // Retrieves the value of the field "powers"
   List powers = Reflection.field("powers").ofType(new TypeRef>() {}).in(jedi).get}();
 
   // Sets the value of the field "powers"
   List powers = new ArrayList();
   powers.add("heal");
   Reflection.field("powers").ofType(new TypeRef>() {}).in(jedi).set(powers);
 
Enclosing class:
FieldTypes

public static class FieldTypes.FieldTypeGenerics<T>
extends java.lang.Object

Encapsulates a Field type suporting generics


Field Summary
private  java.lang.String _fieldName
           
private  TypeRef<T> _fieldType
           
 
Constructor Summary
FieldTypes.FieldTypeGenerics(java.lang.String name, TypeRef<T> type)
           
 
Method Summary
 FieldInvoker<T> in(java.lang.Object 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

FieldTypes.FieldTypeGenerics

FieldTypes.FieldTypeGenerics(java.lang.String name,
                             TypeRef<T> type)
Method Detail

in

public FieldInvoker<T> in(java.lang.Object target)
Returns a new field invoker. A field invoker is capable of accessing (read/write) the underlying field.

Parameters:
target - the object containing the field of interest.
Returns:
the created field invoker.
Throws:
java.lang.NullPointerException - if the given target is null.
ReflectionError - if a field with a matching name and type cannot be found.