Interface ColumnDefinition.Builder<T, B extends ColumnDefinition.Builder<T,B>>

Type Parameters:
T - the underlying type
B - the builder type
All Superinterfaces:
AttributeDefinition.Builder<T,B>, ValueAttributeDefinition.Builder<T,B>
Enclosing interface:
ColumnDefinition<T>

public static sealed interface ColumnDefinition.Builder<T, B extends ColumnDefinition.Builder<T,B>> extends ValueAttributeDefinition.Builder<T,B>
  • Method Details

    • generator

      B generator(Column.Generator<T> generator)
      Specifies that this column value is generated automatically.
      Parameters:
      generator - the value generator
      Returns:
      this builder
    • converter

      <C> B converter(Class<C> columnType, Column.Converter<T,C> converter)
      Sets the actual column type, and the required Column.Converter.

      An enum column is held by the name of its constant, as text, without a converter. A converter replaces that, for an enum held as a code for example, or in a PostgreSQL enum type, which takes its value bound as Types.OTHER, see converter(Class, Converter, SetValue).

      Type Parameters:
      C - the column type
      Parameters:
      columnType - the underlying column type class
      converter - the converter to use when converting to and from column values
      Returns:
      this instance
    • converter

      <C> B converter(Class<C> columnType, Column.Converter<T,C> converter, GetValue<C> getValue)
      Sets the actual column type, and the required Column.Converter.
      Type Parameters:
      C - the column type
      Parameters:
      columnType - the underlying column type class
      converter - the converter to use when converting to and from column values
      getValue - the getter to use to retrieve the value from a ResultSet
      Returns:
      this instance
    • converter

      <C> B converter(Class<C> columnType, Column.Converter<T,C> converter, SetValue<C> setValue)
      Sets the actual column type, and the required Column.Converter.
      Type Parameters:
      C - the column type
      Parameters:
      columnType - the underlying column type class
      converter - the converter to use when converting to and from column values
      setValue - the setter to use when setting parameters in a PreparedStatement
      Returns:
      this instance
    • converter

      <C> B converter(Class<C> columnType, Column.Converter<T,C> converter, GetValue<C> getValue, SetValue<C> setValue)
      Sets the actual column type, and the required Column.Converter.
      Type Parameters:
      C - the column type
      Parameters:
      columnType - the underlying column type class
      converter - the converter to use when converting to and from column values
      getValue - the getter to use to retrieve the value from a ResultSet
      setValue - the setter to use when setting parameters in a PreparedStatement
      Returns:
      this instance
    • name

      B name(String name)
      Sets the actual string used as column name when inserting and updating. This column name is also used when selecting unless an expression(String) has been specified.

      A name which must be quoted in SQL, one which isn't in the case the database folds names to for example, is given quoted, "\"verbatimLocality\"".

      Parameters:
      name - the column name
      Returns:
      this instance
    • expression

      B expression(String expression)
      The expression is used when the column is being selected or used in query conditions.
      Parameters:
      expression - the column expression to use when selecting
      Returns:
      this instance
    • readOnly

      B readOnly(boolean readOnly)
      Specifies whether this column should be included during insert and update operations
      Parameters:
      readOnly - true if this column should be read-only
      Returns:
      this instance
    • insertable

      B insertable(boolean insertable)
      Parameters:
      insertable - specifies whether this column should be included during insert operations
      Returns:
      this instance
    • updatable

      B updatable(boolean updatable)
      Parameters:
      updatable - specifies whether this column is updatable
      Returns:
      this instance
    • withDefault

      B withDefault(boolean withDefault)
      Specifies that the underlying table column has a default value
      Parameters:
      withDefault - true if the database column has a default value
      Returns:
      this instance
    • groupBy

      B groupBy(boolean groupBy)
      Specifies whether this column should be grouped by. A column grouped by is not an aggregate function column, so true also specifies that this is not one, false leaving that as it is.
      Parameters:
      groupBy - true if this is a grouping column
      Returns:
      this instance
    • aggregate

      B aggregate(boolean aggregate)
      Specifies whether this column is an aggregate function column. An aggregate function column is not grouped by, so true also specifies that this one is not, false leaving that as it is.
      Parameters:
      aggregate - true if this is an aggregate function column
      Returns:
      this instance
    • selected

      B selected(boolean selected)

      Specifies whether this column should be included by default when selecting.

      Default true. A primary key column is always selected, an entity without it having no key.

      Parameters:
      selected - false if this column should not be selected by default
      Returns:
      this instance
      Throws:
      IllegalStateException - in case this is a primary key column and selected is false
    • searchable

      B searchable(boolean searchable)
      Specifies whether this column should be included when searching for an entity by a string value. Only applicable to attributes of type Types.VARCHAR.
      Parameters:
      searchable - true if this column is a searchable column
      Returns:
      this instance
      Throws:
      IllegalStateException - in case this column type is not String