Interface Configurable<This>

Type Parameters:
This - The subtype that implements this interface.
All Known Implementing Classes:
Batch, Call, Handle, Jdbi, MetaData, PreparedBatch, Query, Script, SqlStatement, Update

public interface Configurable<This>
A type with access to access and modify arbitrary Jdbi configuration.
  • Method Details

    • getConfig

      ConfigRegistry getConfig()
      Returns the configuration registry associated with this object.
      Returns:
      the configuration registry associated with this object.
    • getConfig

      default <C extends JdbiConfig<C>> C getConfig(Class<C> configClass)
      Gets the configuration object of the given type, associated with this object.
      Type Parameters:
      C - the configuration type
      Parameters:
      configClass - the configuration type
      Returns:
      the configuration object of the given type, associated with this object.
    • configure

      default <C extends JdbiConfig<C>> This configure(Class<C> configClass, Consumer<C> configurer)
      Passes the configuration object of the given type to the configurer, then returns this object.
      Type Parameters:
      C - the configuration type
      Parameters:
      configClass - the configuration type
      configurer - consumer that will be passed the configuration object
      Returns:
      this object (for call chaining)
    • setTemplateEngine

      default This setTemplateEngine(TemplateEngine templateEngine)
      Convenience method for getConfig(SqlStatements.class).setTemplateEngine(rewriter)
      Parameters:
      templateEngine - the template engine
      Returns:
      this
    • setSqlParser

      default This setSqlParser(SqlParser parser)
      Convenience method for getConfig(SqlStatements.class).setSqlParser(rewriter)
      Parameters:
      parser - SQL parser
      Returns:
      this
    • setTimingCollector

      @Deprecated default This setTimingCollector(TimingCollector collector)
      Convenience method for getConfig(SqlStatements.class).setTimingCollector(collector)
      Parameters:
      collector - timing collector
      Returns:
      this
    • setSqlLogger

      default This setSqlLogger(SqlLogger sqlLogger)
    • addCustomizer

      default This addCustomizer(StatementCustomizer customizer)
    • define

      default This define(String key, Object value)
      Convenience method for getConfig(SqlStatements.class).define(key, value)
      Parameters:
      key - attribute name
      value - attribute value
      Returns:
      this
    • registerArgument

      default This registerArgument(ArgumentFactory factory)
      Convenience method for getConfig(Arguments.class).register(factory)
      Parameters:
      factory - argument factory
      Returns:
      this
    • registerArgument

      default This registerArgument(QualifiedArgumentFactory factory)
      Convenience method for getConfig(Arguments.class).register(factory)
      Parameters:
      factory - qualified argument factory
      Returns:
      this
    • setSqlArrayArgumentStrategy

      default This setSqlArrayArgumentStrategy(SqlArrayArgumentStrategy strategy)
      Convenience method for getConfig(SqlArrayTypes.class).setArgumentStrategy(strategy)
      Parameters:
      strategy - argument strategy
      Returns:
      this
    • setMapKeyColumn

      default This setMapKeyColumn(String keyColumn)
      Convenience method for getConfig(MapEntryMappers.class).setKeyColumn(keyColumn)
      Parameters:
      keyColumn - the key column name
      Returns:
      this
    • setMapValueColumn

      default This setMapValueColumn(String valueColumn)
      Convenience method for getConfig(MapEntryMappers.class).setValueColumn(valueColumn)
      Parameters:
      valueColumn - the value column name
      Returns:
      this
    • registerArrayType

      default This registerArrayType(Class<?> elementType, String sqlTypeName)
      Convenience method for getConfig(SqlArrayTypes.class).register(elementType, sqlTypeName)
      Parameters:
      elementType - element type
      sqlTypeName - SQL type name
      Returns:
      this
    • registerArrayType

      default <T> This registerArrayType(Class<T> elementType, String sqlTypeName, Function<T,?> conversion)
      Convenience method for registering an array type as SqlArrayTypeFactory.of(Class, String, Function).
      Type Parameters:
      T - element type
      Parameters:
      elementType - element raw type
      sqlTypeName - SQL type name
      conversion - the function to convert to database representation
      Returns:
      this
    • registerArrayType

      default This registerArrayType(SqlArrayType<?> arrayType)
      Convenience method for getConfig(SqlArrayTypes.class).register(arrayType)
      Parameters:
      arrayType - SQL array type
      Returns:
      this
    • registerArrayType

      default This registerArrayType(SqlArrayTypeFactory factory)
      Convenience method for getConfig(SqlArrayTypes.class).register(factory)
      Parameters:
      factory - SQL array type factory
      Returns:
      this
    • registerCollector

      default This registerCollector(Type collectionType, Collector<?,?,?> collector)
      Convenience method for getConfig(JdbiCollectors.class).register(CollectorFactory.collectorFactory(collectionType, collector))
      Parameters:
      collectionType - collector type to register the collector for
      collector - the Collector to use to build the resulting collection
      Returns:
      this
      Since:
      3.38.0
    • registerCollector

      default This registerCollector(CollectorFactory factory)
      Convenience method for getConfig(JdbiCollectors.class).register(factory)
      Parameters:
      factory - collector factory
      Returns:
      this
    • registerColumnMapper

      default This registerColumnMapper(ColumnMapper<?> mapper)
      Convenience method for getConfig(ColumnMappers.class).register(mapper)
      Parameters:
      mapper - column mapper
      Returns:
      this
    • registerColumnMapper

      default <T> This registerColumnMapper(GenericType<T> type, ColumnMapper<T> mapper)
      Convenience method for getConfig(ColumnMappers.class).register(type, mapper)
      Type Parameters:
      T - the type
      Parameters:
      type - the generic type to register
      mapper - the mapper to use on that type
      Returns:
      this
    • registerColumnMapper

      default This registerColumnMapper(Type type, ColumnMapper<?> mapper)
      Convenience method for getConfig(ColumnMappers.class).register(type, mapper)
      Parameters:
      type - the type to register
      mapper - the mapper to use on that type
      Returns:
      this
    • registerColumnMapper

      default <T> This registerColumnMapper(QualifiedType<T> type, ColumnMapper<T> mapper)
      Convenience method for getConfig(ColumnMappers.class).register(type, mapper)
      Parameters:
      type - the type to register
      mapper - the mapper to use on that type
      Returns:
      this
    • registerColumnMapper

      default This registerColumnMapper(ColumnMapperFactory factory)
      Convenience method for getConfig(ColumnMappers.class).register(factory)
      Parameters:
      factory - column mapper factory
      Returns:
      this
    • registerColumnMapper

      default This registerColumnMapper(QualifiedColumnMapperFactory factory)
      Convenience method for getConfig(ColumnMappers.class).register(factory)
      Parameters:
      factory - column mapper factory
      Returns:
      this
    • registerExtension

      default This registerExtension(ExtensionFactory factory)
      Convenience method for getConfig(Extensions.class).register(factory)
      Parameters:
      factory - extension factory
      Returns:
      this
    • registerRowMapper

      default This registerRowMapper(RowMapper<?> mapper)
      Convenience method for getConfig(RowMappers.class).register(mapper)
      Parameters:
      mapper - row mapper
      Returns:
      this
    • registerRowMapper

      default <T> This registerRowMapper(GenericType<T> type, RowMapper<T> mapper)
      Convenience method for getConfig(RowMappers.class).register(type, mapper)
      Type Parameters:
      T - the type
      Parameters:
      type - to match
      mapper - row mapper
      Returns:
      this
    • registerRowMapper

      default This registerRowMapper(Type type, RowMapper<?> mapper)
      Convenience method for getConfig(RowMappers.class).register(type, mapper)
      Parameters:
      type - to match
      mapper - row mapper
      Returns:
      this
    • registerRowMapper

      default This registerRowMapper(RowMapperFactory factory)
      Convenience method for getConfig(RowMappers.class).register(factory)
      Parameters:
      factory - row mapper factory
      Returns:
      this
    • registerCodecFactory

      @Beta default This registerCodecFactory(CodecFactory codecFactory)
      Convenience method to register a CodecFactory.
      Parameters:
      codecFactory - codec factory
      Returns:
      this