Package org.pgcodekeeper.core.schema
Class AbstractIndex
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.AbstractIndex
- All Implemented Interfaces:
IHashable,IOptionContainer,ISearchPath,ISimpleColumnContainer,ISimpleOptionContainer,IStatement
public abstract class AbstractIndex
extends PgStatement
implements ISimpleOptionContainer, ISimpleColumnContainer, ISearchPath
Abstract base class for database table indexes.
Provides common functionality for indexes across different database types including
unique indexes, clustered indexes, and partial indexes with WHERE clauses.
-
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GOFields inherited from interface org.pgcodekeeper.core.schema.IOptionContainer
GP_OPTION_LIST -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(SimpleColumn column) Adds a column reference to this container.voidaddInclude(String column) Adds an included column to this container.voidAdds an option to this container.booleancompare(PgStatement obj) This method does not account for nested child PgStatements.booleancompareColumns(Collection<String> refs) Compares the columns of this index with a collection of column references.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.Gets the schema that contains this object.Gets all options for this container.Gets the type of this database object.booleanChecks if this statement is a sub-element of another statement.booleanisUnique()voidsetClustered(boolean isClustered) voidsetTablespace(String tableSpace) voidsetUnique(boolean unique) voidCopies 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, getLocation, 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.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.schema.ISimpleOptionContainer
appendOptions, compareOptionsMethods 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
-
setClustered
public void setClustered(boolean isClustered) -
addColumn
Description copied from interface:ISimpleColumnContainerAdds a column reference to this container.- Specified by:
addColumnin interfaceISimpleColumnContainer- Parameters:
column- the simple column to add
-
compareColumns
Compares the columns of this index with a collection of column references.- Parameters:
refs- the collection of column references to compare against- Returns:
- true if the columns match in order and count
-
addInclude
Description copied from interface:ISimpleColumnContainerAdds an included column to this container.- Specified by:
addIncludein interfaceISimpleColumnContainer- Parameters:
column- the column name to include
-
isUnique
public boolean isUnique() -
setUnique
public void setUnique(boolean unique) -
setWhere
-
getTablespace
-
setTablespace
-
getOptions
Description copied from interface:IOptionContainerGets all options for this container.- Specified by:
getOptionsin interfaceIOptionContainer- Returns:
- a map of option keys to values
-
addOption
Description copied from interface:IOptionContainerAdds an option to this container.- Specified by:
addOptionin interfaceIOptionContainer- Parameters:
key- the option keyvalue- the option value
-
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
-
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
-