Class SqlArrayTypes

java.lang.Object
org.jdbi.v3.core.array.SqlArrayTypes
All Implemented Interfaces:
JdbiConfig<SqlArrayTypes>

public class SqlArrayTypes extends Object implements JdbiConfig<SqlArrayTypes>
Configuration class for SQL array binding and mapping.
  • Constructor Details

    • SqlArrayTypes

      public SqlArrayTypes()
  • Method Details

    • getArgumentStrategy

      public SqlArrayArgumentStrategy getArgumentStrategy()
      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(Class<?> elementType, String sqlTypeName)
      Register an array element type that is supported by the JDBC vendor.
      Parameters:
      elementType - the array element type
      sqlTypeName - the vendor-specific SQL type name for the array type. This value will be passed to Connection.createArrayOf(String, Object[]) to create SQL arrays.
      Returns:
      this
    • register

      public SqlArrayTypes register(SqlArrayType<?> arrayType)
      Register a SqlArrayType which will have its parameterized type inspected to determine which element type it supports. SQL array types are used to convert array-like arguments into SQL arrays.

      The parameter must be concretely parameterized; we use the type argument T to determine if it applies to a given element type.

      Parameters:
      arrayType - the SqlArrayType
      Returns:
      this
      Throws:
      UnsupportedOperationException - if the argument is not a concretely parameterized type
    • register

      public SqlArrayTypes register(SqlArrayTypeFactory factory)
      Register a SqlArrayTypeFactory. A factory is provided element types and, if it supports it, provides an SqlArrayType for it.
      Parameters:
      factory - the factory
      Returns:
      this
    • findFor

      public Optional<SqlArrayType<?>> findFor(Type elementType)
      Obtain an SqlArrayType for the given array element type in the given context
      Parameters:
      elementType - the array element type.
      Returns:
      an SqlArrayType for the given element type.
    • setRegistry

      public void setRegistry(ConfigRegistry registry)
      Description copied from interface: JdbiConfig
      The 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:
      setRegistry in interface JdbiConfig<SqlArrayTypes>
      Parameters:
      registry - the registry that owns this configuration object
    • createCopy

      public SqlArrayTypes createCopy()
      Description copied from interface: JdbiConfig
      Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.
      Specified by:
      createCopy in interface JdbiConfig<SqlArrayTypes>
      Returns:
      a copy of this configuration object.