public interface FieldHandler extends ValueHandler, Result<ValueHandler,java.lang.Object>
Field
objects.
For handling a static field, you don't need to specify that instance:
FieldHandler handler = Reflection.handle(Field)
;
Object oldValue = handler.value();
handler.value(newValue);
For handling a non-static field, you must specify an instance:
FieldHandler handler = Reflection.handle(Field)
;
Object oldValue = handler.on(instance).get();
handler.on(instance).value(newValue);
Modifier and Type | Method and Description |
---|---|
ValueHandler |
in(java.lang.Object source)
Handles the value on a given instance (use this if the field is not
static).
|
void |
set(java.lang.Object value)
Sets the value for a static
Field . |
<E> E |
value()
Gets the value for a static
Field . |
<E> E value() throws HandlingException
Field
.value
in interface ValueHandler
HandlingException
- if anything go wrong.void set(java.lang.Object value) throws HandlingException
Field
.set
in interface ValueHandler
value
- the value to set.HandlingException
- if anything go wrongValueHandler in(java.lang.Object source)
in
in interface Result<ValueHandler,java.lang.Object>
source
- the instance. A null
value or a Class
may be
passed if the field is static.