Package com.gpudb

Class TypeObjectMap.ConvertingMethodHandler

    • Constructor Detail

      • ConvertingMethodHandler

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