Class PrimaryKey

All Implemented Interfaces:
Comparable, LiquibaseSerializable, DatabaseObject

public class PrimaryKey extends AbstractDatabaseObject
  • Field Details

  • Constructor Details

    • PrimaryKey

      public PrimaryKey()
    • PrimaryKey

      public PrimaryKey(String name, String tableCatalogName, String tableSchemaName, String tableName, Column... columns)
  • Method Details

    • getContainingObjects

      public DatabaseObject[] getContainingObjects()
    • getName

      public String getName()
    • setName

      public PrimaryKey setName(String name)
      Description copied from interface: DatabaseObject
      Sets the name for the database object.
      Parameters:
      name - the new name for the database object
      Returns:
      a reference to the same object (implementing classes are expected to return a reference to the same object).
    • getSchema

      public Schema getSchema()
    • getColumnNames

      public String getColumnNames()
    • addColumn

      public PrimaryKey addColumn(int position, Column column)
      Adds a new column to the column list of this PrimaryKey. The first column has the position 0. If you specify a position that is greater than the number of columns present, undefined columns (NULL expressions) will be added as padding. If a position that is already occupied by a column is specified, that column will be replaced.
      Parameters:
      position - the position where to insert or replace the column
      column - the new column
      Returns:
      a reference to the updated PrimaryKey object.
    • getTable

      public Table getTable()
      Returns the Table object this PrimaryKey belongs to.
      Returns:
      the Table object, or null if not initialized yet.
    • setTable

      public PrimaryKey setTable(Table table)
      Sets the Table object this PrimaryKey belongs to.
      Parameters:
      table - the table object to set as the container for this PrimaryKey
      Returns:
      the updated object
    • compareTo

      public int compareTo(Object other)
      Specified by:
      compareTo in interface Comparable
      Overrides:
      compareTo in class AbstractDatabaseObject
    • 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 AbstractDatabaseObject
    • getColumns

      public List<Column> getColumns()
    • getColumnNamesAsList

      public List<String> getColumnNamesAsList()
    • isCertainName

      public boolean isCertainName()
    • setCertainName

      public PrimaryKey setCertainName(boolean certainName)
    • getTablespace

      public String getTablespace()
    • setTablespace

      public PrimaryKey setTablespace(String tablespace)
    • getBackingIndex

      public Index getBackingIndex()
    • setBackingIndex

      public PrimaryKey setBackingIndex(Index backingIndex)
    • setShouldValidate

      public PrimaryKey setShouldValidate(boolean shouldValidate)
      Parameters:
      shouldValidate - - if shouldValidate is set to FALSE then the constraint will be created with the 'ENABLE NOVALIDATE' mode. This means the constraint would be created, but that no check will be done to ensure old data has valid primary keys - only new data would be checked to see if it complies with the constraint logic. The default state for primary keys is to have 'ENABLE VALIDATE' set.