public static final class TypeObjectMap.MethodHandler extends Object implements TypeObjectMap.Accessor, TypeObjectMap.Mutator
TypeObjectMap.Accessor
and TypeObjectMap.Mutator
that provides access to a
field via specified get and set methods using reflection. The get method
must be public and take no parameters, and the set method must be public
and take one parameter of the same type returned by the get method.Constructor and Description |
---|
MethodHandler(Method getMethod,
Method setMethod)
Creates a
TypeObjectMap.MethodHandler for the specified get and set
methods. |
Modifier and Type | Method and Description |
---|---|
Object |
get(Object o)
Returns a value from the specified object via the get method
specified in the constructor.
|
void |
set(Object o,
Object value)
Sets a value in the specified object via the set method specified in
the constructor.
|
public MethodHandler(Method getMethod, Method setMethod)
TypeObjectMap.MethodHandler
for the specified get and set
methods. The get method must be public and take no parameters, and
the set method must be public and take one parameter of the same type
returned by the get method.getMethod
- the get methodsetMethod
- the set methodIllegalArgumentException
- if the specified methods are not of
the correct formpublic Object get(Object o)
get
in interface TypeObjectMap.Accessor
o
- the objectGPUdbRuntimeException
- if the value could not be retrievedpublic void set(Object o, Object value)
set
in interface TypeObjectMap.Mutator
o
- the objectvalue
- the new value of the fieldGPUdbRuntimeException
- if the value could not be setCopyright © 2019. All rights reserved.