org.h2.test.jdbc

## Class TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler

- java.lang.Object
- - org.h2.test.jdbc.TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler

All Implemented Interfaces:
  CustomDataTypesHandler

Enclosing class:
  TestCustomDataTypesHandler

    public static class TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler
    extends java.lang.Object
    implements CustomDataTypesHandler

The custom data types handler to use for this test.

### Field Summary

Fields
`static int` `COMPLEX_DATA_TYPE_ID` Type id for complex number
`static java.lang.String` `COMPLEX_DATA_TYPE_NAME` Type name for complex number
`static int` `COMPLEX_DATA_TYPE_ORDER` Order for complex number data type
`DataType` `complexDataType` Cached DataType instance for complex number

### Constructor Summary

Constructors
Constructor and Description
`TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler()`

### 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
`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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### COMPLEX_DATA_TYPE_NAME

    public static final java.lang.String COMPLEX_DATA_TYPE_NAME

Type name for complex number

See Also:
  Constant Field Values

#### COMPLEX_DATA_TYPE_ID

    public static final int COMPLEX_DATA_TYPE_ID

Type id for complex number

See Also:
  Constant Field Values

#### COMPLEX_DATA_TYPE_ORDER

    public static final int COMPLEX_DATA_TYPE_ORDER

Order for complex number data type

See Also:
  Constant Field Values

#### complexDataType

    public final DataType complexDataType

Cached DataType instance for complex number

### Constructor Detail

#### TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler

    public TestCustomDataTypesHandler.TestOnlyCustomDataTypesHandler()

### Method Detail

#### getDataTypeByName

    public DataType getDataTypeByName(java.lang.String name)

Description copied from interface: `CustomDataTypesHandler`
Get custom data type given its name

Specified by:
  `getDataTypeByName` in interface `CustomDataTypesHandler`
Parameters:
  `name` - data type name
Returns:
  custom data type

#### getDataTypeById

    public DataType getDataTypeById(int type)

Description copied from interface: `CustomDataTypesHandler`
Get custom data type given its integer id

Specified by:
  `getDataTypeById` in interface `CustomDataTypesHandler`
Parameters:
  `type` - identifier of a data type
Returns:
  custom data type

#### getDataTypeClassName

    public java.lang.String getDataTypeClassName(int type)

Description copied from interface: `CustomDataTypesHandler`
Get custom data type class name given its integer id

Specified by:
  `getDataTypeClassName` in interface `CustomDataTypesHandler`
Parameters:
  `type` - identifier of a data type
Returns:
  class name

#### getTypeIdFromClass

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

Description copied from interface: `CustomDataTypesHandler`
Get custom data type identifier given corresponding Java class

Specified by:
  `getTypeIdFromClass` in interface `CustomDataTypesHandler`
Parameters:
  `cls` - Java class object
Returns:
  type identifier

#### convert

    public Value convert(Value source,
                int targetType)

Description copied from interface: `CustomDataTypesHandler`
Convert the provided source value into value of given target data type Shall implement conversions to and from custom data types.

Specified by:
  `convert` in interface `CustomDataTypesHandler`
Parameters:
  `source` - source value
  `targetType` - identifier of target data type
Returns:
  converted value

#### getDataTypeOrder

    public int getDataTypeOrder(int type)

Description copied from interface: `CustomDataTypesHandler`
Get order for custom data type given its integer id

Specified by:
  `getDataTypeOrder` in interface `CustomDataTypesHandler`
Parameters:
  `type` - identifier of a data type
Returns:
  order associated with custom data type

#### getValue

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

Description copied from interface: `CustomDataTypesHandler`
Get `Value` object corresponding to given data type identifier and data.

Specified by:
  `getValue` in interface `CustomDataTypesHandler`
Parameters:
  `type` - custom data type identifier
  `data` - underlying data type value
  `dataHandler` - data handler object
Returns:
  Value object

#### getObject

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

Description copied from interface: `CustomDataTypesHandler`
Converts `Value` object to the specified class.

Specified by:
  `getObject` in interface `CustomDataTypesHandler`
Parameters:
  `value` - the value to convert
  `cls` - the target class
Returns:
  result

#### supportsAdd

    public boolean supportsAdd(int type)

Description copied from interface: `CustomDataTypesHandler`
Checks if type supports add operation

Specified by:
  `supportsAdd` in interface `CustomDataTypesHandler`
Parameters:
  `type` - custom data type identifier
Returns:
  True, if custom data type supports add operation

#### getAddProofType

    public int getAddProofType(int type)

Description copied from interface: `CustomDataTypesHandler`
Get compatible type identifier that would not overflow after many add operations.

Specified by:
  `getAddProofType` in interface `CustomDataTypesHandler`
Parameters:
  `type` - identifier of a type
Returns:
  resulting type identifier