org.h2.api

## Interface CustomDataTypesHandler

All Known Implementing Classes:
  TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler

    public interface CustomDataTypesHandler

Custom data type handler Provides means to plug-in custom data types support Please keep in mind that this feature may not possibly provide the same ABI stability level as other features as it exposes many of the H2 internals. You may be required to update your code occasionally due to internal changes in H2 if you are going to use this feature

### Method Summary

Methods
`Value` `convert(Value source, int targetType)` Convert the provided source value into value of given target data type Shall implement conversions to and from custom data types.
`int` `getAddProofType(int type)` Get compatible type identifier that would not overflow after many add operations.
`DataType` `getDataTypeById(int type)` Get custom data type given its integer id
`DataType` `getDataTypeByName(java.lang.String name)` Get custom data type given its name
`java.lang.String` `getDataTypeClassName(int type)` Get custom data type class name given its integer id
`int` `getDataTypeOrder(int type)` Get order for custom data type given its integer id
`java.lang.Object` `getObject(Value value, java.lang.Class<?> cls)` Converts `Value` object to the specified class.
`int` `getTypeIdFromClass(java.lang.Class<?> cls)` Get custom data type identifier given corresponding Java class
`TypeInfo` `getTypeInfoById(int type, long precision, int scale, ExtTypeInfo extTypeInfo)` Get type info for the given data type identity.
`Value` `getValue(int type, java.lang.Object data, DataHandler dataHandler)` Get `Value` object corresponding to given data type identifier and data.
`boolean` `supportsAdd(int type)` Checks if type supports add operation

### Method Detail

#### getDataTypeByName

    DataType getDataTypeByName(java.lang.String name)

Get custom data type given its name

Parameters:
  `name` - data type name
Returns:
  custom data type

#### getDataTypeById

    DataType getDataTypeById(int type)

Get custom data type given its integer id

Parameters:
  `type` - identifier of a data type
Returns:
  custom data type

#### getTypeInfoById

    TypeInfo getTypeInfoById(int type,
                           long precision,
                           int scale,
                           ExtTypeInfo extTypeInfo)

Get type info for the given data type identity.

Parameters:
  `type` - identifier of a data type
  `precision` - precision
  `scale` - scale
  `extTypeInfo` - the extended type information, or null
Returns:
  type information

#### getDataTypeOrder

    int getDataTypeOrder(int type)

Get order for custom data type given its integer id

Parameters:
  `type` - identifier of a data type
Returns:
  order associated with custom data type

#### convert

    Value convert(Value source,
                int targetType)

Convert the provided source value into value of given target data type Shall implement conversions to and from custom data types.

Parameters:
  `source` - source value
  `targetType` - identifier of target data type
Returns:
  converted value

#### getDataTypeClassName

    java.lang.String getDataTypeClassName(int type)

Get custom data type class name given its integer id

Parameters:
  `type` - identifier of a data type
Returns:
  class name

#### getTypeIdFromClass

    int getTypeIdFromClass(java.lang.Class<?> cls)

Get custom data type identifier given corresponding Java class

Parameters:
  `cls` - Java class object
Returns:
  type identifier

#### getValue

    Value getValue(int type,
                 java.lang.Object data,
                 DataHandler dataHandler)

Get `Value` object corresponding to given data type identifier and data.

Parameters:
  `type` - custom data type identifier
  `data` - underlying data type value
  `dataHandler` - data handler object
Returns:
  Value object

#### getObject

    java.lang.Object getObject(Value value,
                             java.lang.Class<?> cls)

Converts `Value` object to the specified class.

Parameters:
  `value` - the value to convert
  `cls` - the target class
Returns:
  result

#### supportsAdd

    boolean supportsAdd(int type)

Checks if type supports add operation

Parameters:
  `type` - custom data type identifier
Returns:
  True, if custom data type supports add operation

#### getAddProofType

    int getAddProofType(int type)

Get compatible type identifier that would not overflow after many add operations.

Parameters:
  `type` - identifier of a type
Returns:
  resulting type identifier