r01f.reflection.fluent
Class FieldTypes.FieldType<T>
java.lang.Object
r01f.reflection.fluent.FieldTypes.FieldType<T>
- Type Parameters:
T - the generic type of the field.
Usage example:
// Retrieves the value of the field "name"
String name = Reflection.field("name").ofType(String.class).in(person).get();
// Sets the value of the field "name" to "Yoda"
Reflection.field("name").ofType(String.class).in(person).set("Yoda");
- Enclosing class:
- FieldTypes
public static class FieldTypes.FieldType<T>
- extends java.lang.Object
Encapsulates a Field type
|
Field Summary |
(package private) java.lang.String |
_fieldName
|
(package private) java.lang.Class<T> |
_fieldType
|
|
Method Summary |
FieldInvoker<T> |
in(java.lang.Object target)
Returns a new field access invoker, capable of accessing (read/write) the underlying field. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_fieldName
final java.lang.String _fieldName
_fieldType
final java.lang.Class<T> _fieldType
FieldTypes.FieldType
FieldTypes.FieldType(java.lang.String fieldName,
java.lang.Class<T> fieldType)
in
public FieldInvoker<T> in(java.lang.Object target)
- Returns a new field access invoker, capable of accessing (read/write) the underlying field.
- Parameters:
target - the object containing the field of interest.
- Returns:
- the created field access invoker.
- Throws:
java.lang.NullPointerException - if the given target is null.
ReflectionError - if a field with a matching name and type cannot be found.