Interface DbMapperManager


public interface DbMapperManager
Mapper manager of all configured mappers.
  • Field Details

    • TYPE_DB_ROW

      static final GenericType<DbRow> TYPE_DB_ROW
      Generic type for the DbRow class.
    • TYPE_NAMED_PARAMS

      static final GenericType<Map<String,?>> TYPE_NAMED_PARAMS
      Generic type for the Map of String to value pairs for named parameters.
    • TYPE_INDEXED_PARAMS

      static final GenericType<List<?>> TYPE_INDEXED_PARAMS
      Generic type for the List of indexed parameters.
  • Method Details

    • builder

      static DbMapperManager.Builder builder()
      Create a fluent API builder to configure the mapper manager.
      Returns:
      a new builder instance
    • create

      static DbMapperManager create()
      Create a new mapper manager from Java Service loader only.
      Returns:
      mapper manager
    • create

      static DbMapperManager create(HelidonServiceLoader<DbMapperProvider> serviceLoader)
      Create a new mapper manager from customized HelidonServiceLoader.
      Parameters:
      serviceLoader - service loader to use to read all DbMapperProvider
      Returns:
      mapper manager
    • read

      <T> T read(DbRow row, Class<T> expectedType) throws MapperException
      Read database row into a typed value.
      Type Parameters:
      T - type of the response
      Parameters:
      row - row from a database
      expectedType - class of the response
      Returns:
      instance with data from the row
      Throws:
      MapperException - in case the mapper was not found
      See Also:
    • read

      <T> T read(DbRow row, GenericType<T> expectedType) throws MapperException
      Read database row into a typed value.
      Type Parameters:
      T - type of the response
      Parameters:
      row - row from a database
      expectedType - generic type of the response
      Returns:
      instance with data from the row
      Throws:
      MapperException - in case the mapper was not found
      See Also:
    • toNamedParameters

      <T> Map<String,?> toNamedParameters(T value, Class<T> valueClass)
      Read object into a map of named parameters.
      Type Parameters:
      T - type of value
      Parameters:
      value - the typed value
      valueClass - type of the value object
      Returns:
      map with the named parameters
      See Also:
    • toIndexedParameters

      <T> List<?> toIndexedParameters(T value, Class<T> valueClass)
      Read object into a list of indexed parameters.
      Type Parameters:
      T - type of value
      Parameters:
      value - the typed value
      valueClass - type of the value object
      Returns:
      list with indexed parameters (in the order expected by statements using this object)
      See Also: