Class CustomizingStatementHandler<StatementType extends SqlStatement<StatementType>>
- java.lang.Object
-
- org.jdbi.v3.sqlobject.statement.internal.CustomizingStatementHandler<StatementType>
-
- All Implemented Interfaces:
ExtensionHandler
- Direct Known Subclasses:
SqlBatchHandler,SqlCallHandler,SqlQueryHandler,SqlScriptsHandler,SqlUpdateHandler
abstract class CustomizingStatementHandler<StatementType extends SqlStatement<StatementType>> extends java.lang.Object implements ExtensionHandler
Base handler for annotations' implementation classes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceCustomizingStatementHandler.BoundCustomizerASqlStatementCustomizerorSqlStatementParameterCustomizerthat is ready to apply.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Methodmethodprivate java.lang.Class<?>sqlObjectTypeprivate java.util.List<CustomizingStatementHandler.BoundCustomizer>statementCustomizers-
Fields inherited from interface org.jdbi.v3.core.extension.ExtensionHandler
EQUALS_HANDLER, HASHCODE_HANDLER, NULL_HANDLER
-
-
Constructor Summary
Constructors Constructor Description CustomizingStatementHandler(java.lang.Class<?> type, java.lang.reflect.Method method)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static java.util.stream.Stream<java.lang.annotation.Annotation>annotationsFor(java.lang.reflect.AnnotatedElement... elements)(package private) voidapplyCustomizers(StatementType stmt, java.lang.Object[] args)(package private) abstract voidconfigureReturner(StatementType stmt, SqlObjectStatementConfiguration cfg)(package private) abstract StatementTypecreateStatement(Handle handle, java.lang.String locatedSql)private CustomizingStatementHandler.BoundCustomizerdefaultParameterCustomizer(java.lang.reflect.Parameter parameter, java.lang.Integer i)Default parameter customizer for parameters with no annotations.private java.util.stream.Stream<CustomizingStatementHandler.BoundCustomizer>eachParameterCustomizers(java.lang.reflect.Parameter parameter, java.lang.Integer i)private static ParameterCustomizerFactorygetDefaultParameterCustomizerFactory(ConfigRegistry config)(package private) java.lang.reflect.MethodgetMethod()(package private) java.lang.reflect.TypegetParameterType(java.lang.reflect.Parameter parameter)private static SqlStatementCustomizerFactoryinstantiateFactory(java.lang.annotation.Annotation annotation)java.lang.Objectinvoke(HandleSupplier handleSupplier, java.lang.Object target, java.lang.Object... args)Gets invoked to return a value for the method that this handler was bound to.(package private) java.lang.StringlocateSql(Handle h)private java.util.stream.Stream<CustomizingStatementHandler.BoundCustomizer>parameterCustomizers()(package private) static RowMapper<?>rowMapperFor(UseRowMapper annotation)(package private) static RowReducer<?,?>rowReducerFor(UseRowReducer annotation)voidwarm(ConfigRegistry config)Called after the method handler is constructed to pre-initialize any important configuration data structures.
-
-
-
Field Detail
-
statementCustomizers
private final java.util.List<CustomizingStatementHandler.BoundCustomizer> statementCustomizers
-
sqlObjectType
private final java.lang.Class<?> sqlObjectType
-
method
private final java.lang.reflect.Method method
-
-
Method Detail
-
warm
public void warm(ConfigRegistry config)
Description copied from interface:ExtensionHandlerCalled after the method handler is constructed to pre-initialize any important configuration data structures.- Specified by:
warmin interfaceExtensionHandler- Parameters:
config- the method configuration to use for warming up
-
annotationsFor
private static java.util.stream.Stream<java.lang.annotation.Annotation> annotationsFor(java.lang.reflect.AnnotatedElement... elements)
-
parameterCustomizers
private java.util.stream.Stream<CustomizingStatementHandler.BoundCustomizer> parameterCustomizers()
-
eachParameterCustomizers
private java.util.stream.Stream<CustomizingStatementHandler.BoundCustomizer> eachParameterCustomizers(java.lang.reflect.Parameter parameter, java.lang.Integer i)
-
defaultParameterCustomizer
private CustomizingStatementHandler.BoundCustomizer defaultParameterCustomizer(java.lang.reflect.Parameter parameter, java.lang.Integer i)
Default parameter customizer for parameters with no annotations.
-
getParameterType
java.lang.reflect.Type getParameterType(java.lang.reflect.Parameter parameter)
-
getDefaultParameterCustomizerFactory
private static ParameterCustomizerFactory getDefaultParameterCustomizerFactory(ConfigRegistry config)
-
instantiateFactory
private static SqlStatementCustomizerFactory instantiateFactory(java.lang.annotation.Annotation annotation)
-
invoke
public java.lang.Object invoke(HandleSupplier handleSupplier, java.lang.Object target, java.lang.Object... args)
Description copied from interface:ExtensionHandlerGets invoked to return a value for the method that this handler was bound to.- Specified by:
invokein interfaceExtensionHandler- Parameters:
handleSupplier- AHandleSupplierinstance for accessing the handle and its related objectstarget- The target object on which the handler should operateargs- Optional arguments for the handler- Returns:
- The return value for the method that was bound to the extension handler. Can be null
-
applyCustomizers
void applyCustomizers(StatementType stmt, java.lang.Object[] args)
-
configureReturner
abstract void configureReturner(StatementType stmt, SqlObjectStatementConfiguration cfg)
-
createStatement
abstract StatementType createStatement(Handle handle, java.lang.String locatedSql)
-
locateSql
java.lang.String locateSql(Handle h)
-
getMethod
java.lang.reflect.Method getMethod()
-
rowMapperFor
static RowMapper<?> rowMapperFor(UseRowMapper annotation)
-
rowReducerFor
static RowReducer<?,?> rowReducerFor(UseRowReducer annotation)
-
-