r01f.reflection.fluent
Class FieldTypes.FieldTypeGenerics<T>
java.lang.Object
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
|
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 |
_fieldName
private final java.lang.String _fieldName
_fieldType
private final TypeRef<T> _fieldType
FieldTypes.FieldTypeGenerics
FieldTypes.FieldTypeGenerics(java.lang.String name,
TypeRef<T> type)
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.