org.firebirdsql.jdbc.field

## Class DefaultObjectConverter

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

-     public final class DefaultObjectConverter
      extends java.lang.Object

  Provides a default implementation of `ObjectConverter`.

  This `ObjectConverter` provides no conversion.

  Since:
    2.2
  Author:
    Mark Rotteveel

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultObjectConverter()`

  - ### Method Summary

    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

    - #### DefaultObjectConverter

          public DefaultObjectConverter()

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

      This implementation always returns `false`.

      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.