Class AbstractConstraint

java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.AbstractConstraint
All Implemented Interfaces:
IHashable, IConstraint, ISearchPath, IStatement
Direct Known Subclasses:
ChConstraint, MsConstraint, PgConstraint

public abstract class AbstractConstraint extends PgStatement implements IConstraint, ISearchPath
Abstract base class for database table constraints. Provides common functionality for constraints across different database types including primary keys, foreign keys, unique constraints, and check constraints.
  • Method Details

    • getStatementType

      public DbObjType getStatementType()
      Description copied from interface: IStatement
      Gets the type of this database object.
      Specified by:
      getStatementType in interface IStatement
      Returns:
      the database object type
    • getColumns

      public Collection<String> getColumns()
      Description copied from interface: IConstraint
      Gets the columns involved in this constraint.
      Specified by:
      getColumns in interface IConstraint
      Returns:
      a collection of column names
    • containsColumn

      public boolean containsColumn(String name)
      Description copied from interface: IConstraint
      Checks if this constraint involves the specified column.
      Specified by:
      containsColumn in interface IConstraint
      Parameters:
      name - the column name to check
      Returns:
      true if the column is part of this constraint
    • isNotValid

      public boolean isNotValid()
    • setNotValid

      public void setNotValid(boolean notValid)
    • getLocation

      public PgObjLocation getLocation()
      Description copied from class: PgStatement
      Gets the location information for this statement.
      Overrides:
      getLocation in class PgStatement
      Returns:
      the location where this statement is defined
    • compare

      public boolean compare(PgStatement obj)
      Description copied from class: PgStatement
      This method does not account for nested child PgStatements. Shallow version of PgStatement.equals(Object)
      Overrides:
      compare in class PgStatement
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Parameters:
      hasher - the hasher instance to use for hash computation
    • shallowCopy

      public AbstractConstraint shallowCopy()
      Description copied from class: PgStatement
      Copies all object properties into a new object and leaves all its children empty.
      Specified by:
      shallowCopy in class PgStatement
      Returns:
      shallow copy of a DB object.
    • getContainingSchema

      public AbstractSchema getContainingSchema()
      Description copied from interface: ISearchPath
      Gets the schema that contains this object.
      Specified by:
      getContainingSchema in interface ISearchPath
      Returns:
      the containing schema
    • getTableName

      public String getTableName()
      Description copied from interface: IConstraint
      Gets the name of the table this constraint belongs to.
      Specified by:
      getTableName in interface IConstraint
      Returns:
      the table name
    • isSubElement

      public boolean isSubElement()
      Description copied from class: PgStatement
      Checks if this statement is a sub-element of another statement.
      Overrides:
      isSubElement in class PgStatement
      Returns:
      true if this is a sub-element