Class Column

java.lang.Object
io.github.mfvanek.pg.model.column.Column
All Implemented Interfaces:
ColumnNameAware, DbObject, TableNameAware, Comparable<Column>

@Immutable public class Column extends Object implements DbObject, ColumnNameAware, Comparable<Column>
A representation of column in database table.
Since:
0.5.0
  • Constructor Details

    • Column

      protected Column(@Nonnull String tableName, @Nonnull String columnName, boolean notNull)
  • Method Details

    • getName

      @Nonnull public final String getName()
      Gets database object name.
      Specified by:
      getName in interface DbObject
      Returns:
      database object name
    • getTableName

      @Nonnull public String getTableName()
      Gets table name.
      Specified by:
      getTableName in interface TableNameAware
      Returns:
      table name
    • getColumnName

      @Nonnull public String getColumnName()
      Gets column name in the table.
      Specified by:
      getColumnName in interface ColumnNameAware
      Returns:
      column name
    • isNotNull

      public boolean isNotNull()
      Shows whether column can or cannot accept null values.
      Specified by:
      isNotNull in interface ColumnNameAware
      Returns:
      true if column cannot accept null values
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(@Nonnull Column other)
      Specified by:
      compareTo in interface Comparable<Column>
    • ofNotNull

      @Nonnull public static Column ofNotNull(@Nonnull String tableName, @Nonnull String columnName)
    • ofNullable

      @Nonnull public static Column ofNullable(@Nonnull String tableName, @Nonnull String columnName)