Class ColumnMetaData

java.lang.Object
org.litebridgedb.db.spi.ColumnMetaData
All Implemented Interfaces:
MappedFieldTarget

public final class ColumnMetaData extends Object implements MappedFieldTarget
Metadata information for a database column.

This class extends the functionality of the Column class to include additional attributes typically associated with database column metadata, such as nullability, data type, size, and others.

Instances of this class are immutable except for specific mutable fields like auto-increment, sequence, and joinColumn, which can be modified after initialization.

  • Constructor Details

    • ColumnMetaData

      public ColumnMetaData(Table table, String name, boolean nullable, int dataType, int size, int decimalDigits, boolean autoIncrement, @Nullable String sequence)
      Construct an instance of ColumnMetaData with specified metadata details about a database column.
      Parameters:
      table - the table to which this column belongs; must not be null
      name - the name of the column; must not be null
      nullable - a flag indicating whether the column allows null values
      dataType - the SQL data type of the column as defined in Types
      size - the size of the column, typically representing the maximum number of characters for string or digits for numeric types
      decimalDigits - the number of decimal digits for the column, applicable for numeric types
      autoIncrement - a flag indicating whether the column is defined as auto-increment
      sequence - the name of the sequence associated with the column, or null if no sequence is associated
    • ColumnMetaData

      public ColumnMetaData(Table table, String name, boolean nullable, int dataType, int size)
      Construct an instance of ColumnMetaData with specified metadata details about a database column.

      Sets decimalDigits to 0, autoIncrement to false, and sequence to null.

      Parameters:
      table - the table to which this column belongs; must not be null
      name - the name of the column; must not be null
      nullable - a flag indicating whether the column allows null values
      dataType - the SQL data type of the column as defined in Types
      size - the size of the column, typically representing the maximum number of characters for string or digits for numeric types
    • ColumnMetaData

      public ColumnMetaData(Table table, String name, boolean nullable, int dataType)
      Construct an instance of ColumnMetaData with specified metadata details about a database column.

      Sets decimalDigits and size to 0, autoIncrement to false, and sequence to null.

      Parameters:
      table - the table to which this column belongs; must not be null
      name - the name of the column; must not be null
      nullable - a flag indicating whether the column allows null values
      dataType - the SQL data type of the column as defined in Types
  • Method Details

    • name

      public String name()
    • table

      public Table table()
    • isNullable

      public boolean isNullable()
      Determine if the column allows null values.
      Returns:
      true if the column allows null values, otherwise false.
    • getDataType

      public int getDataType()
      Retrieve the data type of the column, as specified in Types.
      Returns:
      the SQL data type.
      See Also:
    • getSize

      public int getSize()
      Retrieve the size of the column.
      Returns:
      the size of the column.
    • getDecimalDigits

      public int getDecimalDigits()
      Retrieve the number of decimal digits for the column.
      Returns:
      the number of decimal digits specified for the column.
    • isAutoIncrement

      public boolean isAutoIncrement()
      Check if the column's value is automatically incremented by the database.
      Returns:
      true if the column is marked as auto-increment, false otherwise.
    • setAutoIncrement

      public void setAutoIncrement(boolean autoIncrement)
    • getSequence

      public @Nullable String getSequence()
    • setSequence

      public void setSequence(@Nullable String sequence)
    • getJoinColumn

      public @Nullable String getJoinColumn()
    • setJoinColumn

      public void setJoinColumn(@Nullable String joinColumn)
    • toColumn

      public Column toColumn()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object