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