Package org.jdbi.v3.core.array
Class SqlArrayTypes
- java.lang.Object
-
- org.jdbi.v3.core.array.SqlArrayTypes
-
- All Implemented Interfaces:
JdbiConfig<SqlArrayTypes>
public class SqlArrayTypes extends java.lang.Object implements JdbiConfig<SqlArrayTypes>
Configuration class for SQL array binding and mapping.
-
-
Field Summary
Fields Modifier and Type Field Description private SqlArrayArgumentStrategyargumentStrategyprivate java.util.List<SqlArrayTypeFactory>factoriesprivate JdbiInterceptionChainHolder<SqlArrayType<?>,SqlArrayTypeFactory>inferenceInterceptorsprivate ConfigRegistryregistry
-
Constructor Summary
Constructors Modifier Constructor Description SqlArrayTypes()privateSqlArrayTypes(SqlArrayTypes that)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlArrayTypescreateCopy()Returns a copy of this configuration object.java.util.Optional<SqlArrayType<?>>findFor(java.lang.reflect.Type elementType)Obtain anSqlArrayTypefor the given array element type in the given contextSqlArrayArgumentStrategygetArgumentStrategy()Returns the strategy used to bind array-type arguments to SQL statements.JdbiInterceptionChainHolder<SqlArrayType<?>,SqlArrayTypeFactory>getInferenceInterceptors()Returns theJdbiInterceptionChainHolderfor the SqlArrayType inference.SqlArrayTypesregister(java.lang.Class<?> elementType, java.lang.String sqlTypeName)Register an array element type that is supported by the JDBC vendor.SqlArrayTypesregister(SqlArrayType<?> arrayType)Register aSqlArrayTypewhich will have its parameterized type inspected to determine which element type it supports.SqlArrayTypesregister(SqlArrayTypeFactory factory)Register aSqlArrayTypeFactory.SqlArrayTypessetArgumentStrategy(SqlArrayArgumentStrategy argumentStrategy)Sets the strategy used when binding array-type arguments to SQL statements.voidsetRegistry(ConfigRegistry registry)The registry will inject itself into the configuration object.
-
-
-
Field Detail
-
inferenceInterceptors
private final JdbiInterceptionChainHolder<SqlArrayType<?>,SqlArrayTypeFactory> inferenceInterceptors
-
factories
private final java.util.List<SqlArrayTypeFactory> factories
-
argumentStrategy
private SqlArrayArgumentStrategy argumentStrategy
-
registry
private ConfigRegistry registry
-
-
Constructor Detail
-
SqlArrayTypes
public SqlArrayTypes()
-
SqlArrayTypes
private SqlArrayTypes(SqlArrayTypes that)
-
-
Method Detail
-
getArgumentStrategy
public SqlArrayArgumentStrategy getArgumentStrategy()
Returns the strategy used to bind array-type arguments to SQL statements.- Returns:
- the strategy used to bind array-type arguments to SQL statements
-
setArgumentStrategy
public SqlArrayTypes setArgumentStrategy(SqlArrayArgumentStrategy argumentStrategy)
Sets the strategy used when binding array-type arguments to SQL statements.- Parameters:
argumentStrategy- the argument strategy to set- Returns:
- this
-
register
public SqlArrayTypes register(java.lang.Class<?> elementType, java.lang.String sqlTypeName)
Register an array element type that is supported by the JDBC vendor.- Parameters:
elementType- the array element typesqlTypeName- the vendor-specific SQL type name for the array type. This value will be passed toConnection.createArrayOf(String, Object[])to create SQL arrays.- Returns:
- this
-
register
public SqlArrayTypes register(SqlArrayType<?> arrayType)
Register aSqlArrayTypewhich will have its parameterized type inspected to determine which element type it supports.SQL array typesare used to convert array-like arguments into SQL arrays.The parameter must be concretely parameterized; we use the type argument
Tto determine if it applies to a given element type.- Parameters:
arrayType- theSqlArrayType- Returns:
- this
- Throws:
java.lang.UnsupportedOperationException- if the argument is not a concretely parameterized type
-
register
public SqlArrayTypes register(SqlArrayTypeFactory factory)
Register aSqlArrayTypeFactory. A factory is provided element types and, if it supports it, provides anSqlArrayTypefor it.- Parameters:
factory- the factory- Returns:
- this
-
findFor
public java.util.Optional<SqlArrayType<?>> findFor(java.lang.reflect.Type elementType)
Obtain anSqlArrayTypefor the given array element type in the given context- Parameters:
elementType- the array element type.- Returns:
- an
SqlArrayTypefor the given element type.
-
setRegistry
public void setRegistry(ConfigRegistry registry)
Description copied from interface:JdbiConfigThe registry will inject itself into the configuration object. This can be useful if you need to look up dependencies. You will get a new registry after being copied.- Specified by:
setRegistryin interfaceJdbiConfig<SqlArrayTypes>- Parameters:
registry- the registry that owns this configuration object
-
getInferenceInterceptors
@Alpha public JdbiInterceptionChainHolder<SqlArrayType<?>,SqlArrayTypeFactory> getInferenceInterceptors()
Returns theJdbiInterceptionChainHolderfor the SqlArrayType inference. This chain allows registration of custom interceptors to change the standard type inference for theregister(SqlArrayType)method.
-
createCopy
public SqlArrayTypes createCopy()
Description copied from interface:JdbiConfigReturns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopyin interfaceJdbiConfig<SqlArrayTypes>- Returns:
- a copy of this configuration object.
-
-