public class ReflectionAccessor extends Object implements DefinitionAccessor<Object>
DefinitionAccessor
which accesses the automatable
ParamDefinition
's fields via reflection.
Collections of definitions are supported and can be accessed individually by their titles.
DefinitionAccessor.Identifier<T>
Constructor and Description |
---|
ReflectionAccessor(ParamDefinition target)
Constructs a
ReflectionAccessor targeting the given definition. |
Modifier and Type | Method and Description |
---|---|
Object |
get(DefinitionAccessor.Identifier<?> identifier)
Gets the value the given identifier is pointing at.
|
Set<DefinitionAccessor.Identifier<Field>> |
identifiers()
Returns the set of identifiers associated with a value.
|
Object |
set(DefinitionAccessor.Identifier<?> identifier,
Object value)
Sets a value pointed at by a given identifier with a given one.
|
public ReflectionAccessor(ParamDefinition target)
ReflectionAccessor
targeting the given definition.target
- public Set<DefinitionAccessor.Identifier<Field>> identifiers()
DefinitionAccessor
identifiers
in interface DefinitionAccessor<Object>
public Object set(DefinitionAccessor.Identifier<?> identifier, Object value)
DefinitionAccessor
set
in interface DefinitionAccessor<Object>
identifier
- the identifier pointing to the value to be setvalue
- the value the identifier is to point atIllegalArgumentException
- if the given identifier is invalid or null
ClassCastException
- if given value's type does not match VNotAutomatable.IllegalAutomationException
- if the given identifier cannot be automatedIllegalStateException
- if associated field could not be accessedpublic Object get(DefinitionAccessor.Identifier<?> identifier)
DefinitionAccessor
get
in interface DefinitionAccessor<Object>
identifier
- the identifier to get the value forIllegalArgumentException
- if the given identifier is invalid or null
NotAutomatable.IllegalAutomationException
- if the given identifier cannot be automated