Interface Column

All Superinterfaces:
Comparable<Column>
All Known Implementing Classes:
ColumnImpl

@Immutable public interface Column extends Comparable<Column>
An immutable definition of a column.
Author:
Randall Hauch
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the database-specific name of the character set used by this column.
    Get the comment of the column.
    default int
     
    Get the database-specific complete expression defining the column's default value.
    Obtain an editor that contains the same information as this column definition.
    Obtain an column definition editor that can be used to define a column.
    Get the list of values associated with the enum
    boolean
    Determine whether this column's has a default value
    boolean
    Determine whether this column's values are automatically incremented by the database.
    boolean
    Determine whether this column's values are generated by the database.
    boolean
    Determine whether this column is optional.
    default boolean
    Determine whether this column is required.
    int
    Get the JDBC type for this column
    int
    Get the maximum length of this column's values.
    Get the name of the column.
    int
    Get the database native type for this column
    int
    Get the position of the column in the table.
    Get the scale of the column.
    Get the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.
    Get the database-specific name of the column's data type.
    default boolean
    Determine whether this column has a typeName() or jdbcType() to which a character set applies.
  • Field Details

  • Method Details

    • editor

      static ColumnEditor editor()
      Obtain an column definition editor that can be used to define a column.
      Returns:
      the editor; never null
    • name

      String name()
      Get the name of the column.
      Returns:
      the column name; never null
    • position

      int position()
      Get the position of the column in the table.
      Returns:
      the 1-based position
    • jdbcType

      int jdbcType()
      Get the JDBC type for this column
      Returns:
      the type constant
    • nativeType

      int nativeType()
      Get the database native type for this column
      Returns:
      a type constant for the specific database
    • typeName

      String typeName()
      Get the database-specific name of the column's data type.
      Returns:
      the name of the type
    • typeExpression

      String typeExpression()
      Get the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.
      Returns:
      the complete type expression
    • charsetName

      String charsetName()
      Get the database-specific name of the character set used by this column.
      Returns:
      the database-specific character set name, or null if the column's data type doesn't use character sets or no character set is specified
    • length

      int length()
      Get the maximum length of this column's values. For numeric columns, this represents the precision.
      Returns:
      the length of the column
    • scale

      Optional<Integer> scale()
      Get the scale of the column.
      Returns:
      the scale if it applies to this type
    • isOptional

      boolean isOptional()
      Determine whether this column is optional.
      Returns:
      true if it is optional, or false otherwise
      See Also:
    • isRequired

      default boolean isRequired()
      Determine whether this column is required. This is equivalent to calling !isOptional().
      Returns:
      true if it is required (not optional), or false otherwise
      See Also:
    • isAutoIncremented

      boolean isAutoIncremented()
      Determine whether this column's values are automatically incremented by the database.
      Returns:
      true if the values are auto-incremented, or false otherwise
    • isGenerated

      boolean isGenerated()
      Determine whether this column's values are generated by the database.
      Returns:
      true if the values are generated, or false otherwise
    • defaultValueExpression

      Optional<String> defaultValueExpression()
      Get the database-specific complete expression defining the column's default value.
      Returns:
      the complete type expression
    • hasDefaultValue

      boolean hasDefaultValue()
      Determine whether this column's has a default value
      Returns:
      true if the default value was provided, or false otherwise
    • enumValues

      List<String> enumValues()
      Get the list of values associated with the enum
      Returns:
      the list of enum values
    • comment

      String comment()
      Get the comment of the column.
      Returns:
      the column comment; may be null if not set
    • compareTo

      default int compareTo(Column that)
      Specified by:
      compareTo in interface Comparable<Column>
    • edit

      ColumnEditor edit()
      Obtain an editor that contains the same information as this column definition.
      Returns:
      the editor; never null
    • typeUsesCharset

      default boolean typeUsesCharset()
      Determine whether this column has a typeName() or jdbcType() to which a character set applies.
      Returns:
      true if a character set applies the column's type, or false otherwise