Package org.pgcodekeeper.core.schema
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
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.
-
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Method Summary
Modifier and TypeMethodDescriptionbooleancompare(PgStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.booleancontainsColumn(String name) Checks if this constraint involves the specified column.Gets the columns involved in this constraint.Gets the schema that contains this object.Gets the location information for this statement.Gets the type of this database object.Gets the name of the table this constraint belongs to.booleanbooleanChecks if this statement is a sub-element of another statement.voidsetNotValid(boolean notValid) Copies all object properties into a new object and leaves all its children empty.Methods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendAlterSQL, appendComments, appendOwnerSQL, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getCreationSQL, getDbType, getDeps, getDescendants, getDropSQL, getDropSQL, getLibName, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.schema.IConstraint
getDefinition, isPrimaryKeyMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent, getQualifiedName
-
Method Details
-
getStatementType
Description copied from interface:IStatementGets the type of this database object.- Specified by:
getStatementTypein interfaceIStatement- Returns:
- the database object type
-
getColumns
Description copied from interface:IConstraintGets the columns involved in this constraint.- Specified by:
getColumnsin interfaceIConstraint- Returns:
- a collection of column names
-
containsColumn
Description copied from interface:IConstraintChecks if this constraint involves the specified column.- Specified by:
containsColumnin interfaceIConstraint- 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
Description copied from class:PgStatementGets the location information for this statement.- Overrides:
getLocationin classPgStatement- Returns:
- the location where this statement is defined
-
compare
Description copied from class:PgStatementThis method does not account for nested child PgStatements. Shallow version ofPgStatement.equals(Object)- Overrides:
comparein classPgStatement
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Parameters:
hasher- the hasher instance to use for hash computation
-
shallowCopy
Description copied from class:PgStatementCopies all object properties into a new object and leaves all its children empty.- Specified by:
shallowCopyin classPgStatement- Returns:
- shallow copy of a DB object.
-
getContainingSchema
Description copied from interface:ISearchPathGets the schema that contains this object.- Specified by:
getContainingSchemain interfaceISearchPath- Returns:
- the containing schema
-
getTableName
Description copied from interface:IConstraintGets the name of the table this constraint belongs to.- Specified by:
getTableNamein interfaceIConstraint- Returns:
- the table name
-
isSubElement
public boolean isSubElement()Description copied from class:PgStatementChecks if this statement is a sub-element of another statement.- Overrides:
isSubElementin classPgStatement- Returns:
- true if this is a sub-element
-