Class AbstractJdbiConfigurationModule
- java.lang.Object
-
- com.google.inject.AbstractModule
-
- org.jdbi.v3.guice.AbstractJdbiConfigurationModule
-
- All Implemented Interfaces:
com.google.inject.Module,JdbiBinder
public abstract class AbstractJdbiConfigurationModule extends com.google.inject.AbstractModule implements JdbiBinder
Base module class for element configuration modules.In more complex projects with multiple
Jdbidefinitions, there are often elements (e.g. mappers or plugins) that should be shared between all instances.Modules that extend
AbstractJdbiConfigurationModulebind Jdbi related elements such as mappers, plugins, codecs etc. which then are used by Jdbi definition modules (which extendAbstractJdbiDefinitionModule). Any binding that is defined here will be added to any Jdbi definition as long as they either use the same configuration annotation. By default (unless using the constructors that explicitly take an annotation), all Jdbi definitions have all configurations assigned.This module does neither define a Jdbi binding nor requires a data source to be bound. Jdbi instances are defined in modules extending
AbstractJdbiDefinitionModule(which are private guice modules).
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<? extends java.lang.annotation.Annotation>annotationClassprivate InternalJdbiBinderjdbiBinder
-
Constructor Summary
Constructors Constructor Description AbstractJdbiConfigurationModule()Creates an element configuration module.AbstractJdbiConfigurationModule(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Creates an element configuration module with a custom annotation.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidconfigure()abstract voidconfigureJdbi()Override this method to create bindings that will be used in Jdbi definition modules.JdbiBinderjdbiBinder()Provides access to theJdbiBinderinstance.-
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jdbi.v3.guice.JdbiBinder
bindArrayType, bindCodec, bindCodec, bindCodec, bindColumnMapper, bindColumnMapper, bindColumnMapper, bindColumnMapper, bindCustomizer, bindPlugin, bindRowMapper, bindRowMapper, bindRowMapper
-
-
-
-
Field Detail
-
jdbiBinder
private InternalJdbiBinder jdbiBinder
-
annotationClass
private final java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass
-
-
Constructor Detail
-
AbstractJdbiConfigurationModule
public AbstractJdbiConfigurationModule()
Creates an element configuration module.All elements defined in this module will be bound using the
JdbiGlobalannotation. This is the used byAbstractJdbiDefinitionModuleinstances unless a custom annotation is used.
-
AbstractJdbiConfigurationModule
public AbstractJdbiConfigurationModule(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Creates an element configuration module with a custom annotation.All elements defined in this module will be bound using the given custom annotation. This allows creating multiple sets of element configuration modules which can be referenced from modules extending the
AbstractJdbiDefinitionModulebase class if a the same custom annotation is used.
-
-
Method Detail
-
configure
protected final void configure()
- Overrides:
configurein classcom.google.inject.AbstractModule
-
configureJdbi
public abstract void configureJdbi()
Override this method to create bindings that will be used in Jdbi definition modules.
-
jdbiBinder
public final JdbiBinder jdbiBinder()
Provides access to theJdbiBinderinstance.Only valid when called from
configureJdbi().- Specified by:
jdbiBinderin interfaceJdbiBinder
-
-