org.firebirdsql.jdbc.field

## Class JDBC42ObjectConverter

- java.lang.Object
- - org.firebirdsql.jdbc.field.JDBC42ObjectConverter

-     public class JDBC42ObjectConverter
      extends java.lang.Object

  Implementation of `ObjectConverter` to support JDBC 4.2 type conversions.
  Since:
    2.2
  Author:
    Mark Rotteveel

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JDBC42ObjectConverter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `getObject(FBField field, java.lang.Class<T> type)` Get object with the specified type.
    `boolean` | `setObject(FBField field, java.lang.Object object)` If the `object` type is supported, and the object (or its conversion) is allowed by JDBC, it sets the `field` with the (converted) object.

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

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

- - ### Constructor Detail

    - #### JDBC42ObjectConverter

          public JDBC42ObjectConverter()

  - ### Method Detail

    - #### setObject

          public boolean setObject(FBField field,
                                   java.lang.Object object)
                            throws java.sql.SQLException

      If the `object` type is supported, and the object (or its conversion) is allowed by JDBC, it sets the `field` with the (converted) object.

      As this method is - for the time being - intended as a workaround for JDBC 4.2, it specifically only supports new conversions in JDBC 4.2. It will return false for any other object type.

      Parameters:
        `field` - FBField implementation to set
        `object` - The object value to set
      Returns:
        `true` when a conversion was applied, `false` when there is no conversion for the object and field
      Throws:
        `java.sql.SQLException` - For exceptions when setting the object on the field (eg unsupported conversion).

    - #### getObject

          public <T> T getObject(FBField field,
                                 java.lang.Class<T> type)
                          throws java.sql.SQLException

      Get object with the specified type.

      As this method is - for the time being - intended as a workaround for JDBC 4.2, it specifically only supports new conversions in JDBC 4.2. It will return false for any other object type.

      Type Parameters:
        `T` - Type parameter
      Parameters:
        `field` - FBField implementation to set
        `type` - Type conversion to get
      Returns:
        Value of the field in the specified type, or `null` when null.
      Throws:
        `java.sql.SQLException` - For conversion errors and unsupported types.

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.