Package com.gpudb

Class TypeObjectMap.ConvertingFieldHandler

    • Constructor Detail

      • ConvertingFieldHandler

        public ConvertingFieldHandler​(Field field,
                                      Type.Column column)
        Creates a TypeObjectMap.ConvertingFieldHandler for the specified field and GPUdb column. Field values will be converted to and from the data type of the column.
        Parameters:
        field - the field
        column - 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 GPUdb column specified in the constructor. The object must belong to the class containing the field.
        Specified by:
        get in interface TypeObjectMap.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 GPUdb column specified in the constructor. The object must belong to the class containing the field.
        Specified by:
        set in interface TypeObjectMap.Mutator
        Parameters:
        o - the object
        value - the unconverted new value of the field
        Throws:
        GPUdbRuntimeException - if the value could not be set