Class MetaConstraint

java.lang.Object
org.pgcodekeeper.core.database.base.schema.meta.MetaStatement
org.pgcodekeeper.core.database.base.schema.meta.MetaConstraint
All Implemented Interfaces:
Serializable, IConstraint, IConstraintPk, ISearchPath, IStatement, ISubElement

public final class MetaConstraint extends MetaStatement implements IConstraintPk
Represents a database constraint metadata object. Provides information about table constraints including primary keys and column references.
See Also:
  • Constructor Details

    • MetaConstraint

      public MetaConstraint(ObjectLocation object)
      Creates a new constraint metadata object.
      Parameters:
      object - the object location information
  • Method Details

    • isPrimaryKey

      public boolean isPrimaryKey()
      Description copied from interface: IConstraint
      Checks if this constraint is a primary key constraint.
      Specified by:
      isPrimaryKey in interface IConstraint
      Returns:
      true if this is a primary key constraint
    • getColumns

      public Set<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
    • setPrimaryKey

      public void setPrimaryKey(boolean isPrimaryKey)
    • addColumn

      public void addColumn(String column)
      Adds a column to this constraint.
      Parameters:
      column - the column name to add
    • getContainingSchema

      public ISchema getContainingSchema()
      Returns the containing schema of this constraint. This operation is not supported for metadata constraints.
      Specified by:
      getContainingSchema in interface ISearchPath
      Specified by:
      getContainingSchema in interface ISubElement
      Returns:
      never returns normally
      Throws:
      IllegalStateException - always thrown as this operation is unsupported
    • getSchemaName

      public String getSchemaName()
      Returns the schema name of this constraint.
      Specified by:
      getSchemaName in interface ISearchPath
      Returns:
      the schema name
    • getTableName

      public String getTableName()
      Returns the table name of this constraint.
      Specified by:
      getTableName in interface IConstraint
      Returns:
      the table name
    • getDefinition

      public String getDefinition()
      Returns the constraint definition. This operation is not supported for metadata constraints.
      Specified by:
      getDefinition in interface IConstraint
      Returns:
      never returns normally
      Throws:
      IllegalStateException - always thrown as this operation is unsupported
    • isClustered

      public boolean isClustered()
      Description copied from interface: IConstraintPk
      Checks if this primary key constraint is clustered.
      Specified by:
      isClustered in interface IConstraintPk
      Returns:
      true if the primary key is clustered