com.holonplatform.datastore.jdbc.composer.internal

## Class CallbackSQLResultConverter<R>

- java.lang.Object
- - com.holonplatform.datastore.jdbc.composer.internal.CallbackSQLResultConverter<R>

- Type Parameters:
    `R` - Conversion result type
  All Implemented Interfaces:
    SQLResultConverter<R>

      public class CallbackSQLResultConverter<R>
      extends Object
      implements SQLResultConverter<R>

  A `SQLResultConverter` implementation which uses a callback `Function` to perform actual result conversion.
  Since:
    5.1.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CallbackSQLResultConverter(Class<? extends R> conversionType, BiFunction<SQLExecutionContext,SQLResult,R> conversionFunction)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `R` | `convert(SQLExecutionContext context, SQLResult result)` Convert a `SQLResult` into expected result type.
    `Class<? extends R>` | `getConversionType()` Get the type into which this converter is able to convert a `SQLResult`.

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

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

    - ### Methods inherited from interface com.holonplatform.datastore.jdbc.composer.SQLResultConverter

      `create`

- - ### Constructor Detail

    - #### CallbackSQLResultConverter

          public CallbackSQLResultConverter(Class<? extends R> conversionType,
                                            BiFunction<SQLExecutionContext,SQLResult,R> conversionFunction)

      Constructor.
      Parameters:
        `conversionType` - Conversion type (not null)
        `conversionFunction` - Conversion function (not null)

  - ### Method Detail

    - #### getConversionType

          public Class<? extends R> getConversionType()

      Description copied from interface: `SQLResultConverter`
      Get the type into which this converter is able to convert a `SQLResult`.
      Specified by:
        `getConversionType` in interface `SQLResultConverter<R>`
      Returns:
        The conversion type

    - #### convert

          public R convert(SQLExecutionContext context,
                           SQLResult result)
                    throws SQLException

      Description copied from interface: `SQLResultConverter`
      Convert a `SQLResult` into expected result type.
      Specified by:
        `convert` in interface `SQLResultConverter<R>`
      Parameters:
        `context` - SQL execution context
        `result` - The result to convert
      Returns:
        Converted result
      Throws:
        `SQLException` - If an error occurred

Copyright © 2019 The Holon Platform. All rights reserved.