Package com.gpudb
Class TypeObjectMap.ConvertingMethodHandler
- java.lang.Object
-
- com.gpudb.TypeObjectMap.ConvertingMethodHandler
-
- All Implemented Interfaces:
TypeObjectMap.Accessor,TypeObjectMap.Mutator
- Enclosing class:
- TypeObjectMap<T>
public static final class TypeObjectMap.ConvertingMethodHandler extends Object implements TypeObjectMap.Accessor, TypeObjectMap.Mutator
A combinedTypeObjectMap.AccessorandTypeObjectMap.Mutatorthat provides access to a field via specified get and set methods using reflection, converting the value to and from the data type of a specified GPUdbcolumn. 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 Summary
Constructors Constructor Description ConvertingMethodHandler(Method getMethod, Method setMethod, Type.Column column)Creates aTypeObjectMap.ConvertingMethodHandlerfor the specified get and set methods and GPUdbcolumn.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectget(Object o)Returns a value from the specified object via the get method specified in the constructor, converting it to the data type of the GPUdbcolumnspecified in the constructor.voidset(Object o, Object value)Sets a value in the specified object via the set method specified in the constructor after converting it from the data type of the GPUdbcolumnspecified in the constructor.
-
-
-
Constructor Detail
-
ConvertingMethodHandler
public ConvertingMethodHandler(Method getMethod, Method setMethod, Type.Column column)
Creates aTypeObjectMap.ConvertingMethodHandlerfor the specified get and set methods and GPUdbcolumn. Field values will be converted to and from the data type of the column.- Parameters:
getMethod- the get methodsetMethod- the set methodcolumn- the column- Throws:
IllegalArgumentException- if the specified methods are not of the correct form or the field does not have a data type that is supported for conversion
-
-
Method Detail
-
get
public Object get(Object o)
Returns a value from the specified object via the get method specified in the constructor, converting it to the data type of the GPUdbcolumnspecified in the constructor. The object must belong to the class containing the method.- Specified by:
getin interfaceTypeObjectMap.Accessor- Parameters:
o- the object- Returns:
- the value returned by the get method
- Throws:
GPUdbRuntimeException- if the value could not be retrieved
-
set
public void set(Object o, Object value)
Sets a value in the specified object via the set method specified in the constructor after converting it from the data type of the GPUdbcolumnspecified in the constructor. The object must belong to the class containing the method.- Specified by:
setin interfaceTypeObjectMap.Mutator- Parameters:
o- the objectvalue- the new value of the field- Throws:
GPUdbRuntimeException- if the value could not be set
-
-