Enum Class BindListStyle

java.lang.Object
java.lang.Enum<BindListStyle>
org.jdbi.v3.core.statement.BindListStyle
All Implemented Interfaces:
Serializable, Comparable<BindListStyle>, Constable

@Alpha public enum BindListStyle extends Enum<BindListStyle>
Describes how SqlStatement.bindList(String, Object...) renders the bound parameter names into the defined attribute. The style must match the SQL around the attribute, so it is normally set per statement with configure(SqlStatements.class, c -> c.setBindListStyle(...)) or @BindList(style = ...).
See Also:
  • Enum Constant Details

    • PLAIN

      public static final BindListStyle PLAIN

      Render each element as a bare parameter.

      select * from things where x in (<ids>) renders as select * from things where x in (:__ids_0,:__ids_1)

    • ROWS

      public static final BindListStyle ROWS

      Render each element as a single-column row, for use with the SQL VALUES list constructor.

      select * from (values <ids>) as t(id) renders as select * from (values (:__ids_0),(:__ids_1)) as t(id)

      EmptyHandling.NULL_KEYWORD renders values null, which is not valid SQL. Handle an empty list with EmptyHandling.THROW or EmptyHandling.DEFINE_NULL and a template conditional instead.

  • Method Details

    • values

      public static BindListStyle[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BindListStyle valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null