Class MetaConstraint
java.lang.Object
org.pgcodekeeper.core.schema.meta.MetaStatement
org.pgcodekeeper.core.schema.meta.MetaConstraint
- All Implemented Interfaces:
Serializable,IConstraint,ISearchPath,IStatement
Represents a database constraint metadata object.
Provides information about table constraints including primary keys and column references.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMetaConstraint(PgObjLocation object) Creates a new constraint metadata object. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a column to this constraint.booleancontainsColumn(String name) Checks if this constraint involves the specified column.Gets the columns involved in this constraint.Returns the containing schema of this constraint.Returns the constraint definition.Returns the schema name of this constraint.Returns the table name of this constraint.booleanChecks if this constraint is a primary key constraint.voidsetPrimaryKey(boolean isPrimaryKey) Methods inherited from class org.pgcodekeeper.core.schema.meta.MetaStatement
getBareName, getComment, getDatabase, getFilePath, getGenericColumn, getLineNumber, getName, getObject, getObjLength, getOffset, getParent, getQualifiedName, getStatementType, setCommentMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabaseMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent, getQualifiedName, getStatementType
-
Constructor Details
-
MetaConstraint
Creates a new constraint metadata object.- Parameters:
object- the object location information
-
-
Method Details
-
isPrimaryKey
public boolean isPrimaryKey()Description copied from interface:IConstraintChecks if this constraint is a primary key constraint.- Specified by:
isPrimaryKeyin interfaceIConstraint- Returns:
- true if this is a primary key constraint
-
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
-
setPrimaryKey
public void setPrimaryKey(boolean isPrimaryKey) -
addColumn
Adds a column to this constraint.- Parameters:
column- the column name to add
-
getContainingSchema
Returns the containing schema of this constraint. This operation is not supported for metadata constraints.- Specified by:
getContainingSchemain interfaceISearchPath- Returns:
- never returns normally
- Throws:
IllegalStateException- always thrown as this operation is unsupported
-
getSchemaName
Returns the schema name of this constraint.- Specified by:
getSchemaNamein interfaceISearchPath- Returns:
- the schema name
-
getTableName
Returns the table name of this constraint.- Specified by:
getTableNamein interfaceIConstraint- Returns:
- the table name
-
getDefinition
Returns the constraint definition. This operation is not supported for metadata constraints.- Specified by:
getDefinitionin interfaceIConstraint- Returns:
- never returns normally
- Throws:
IllegalStateException- always thrown as this operation is unsupported
-