Class AbstractIndex

java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.AbstractIndex
All Implemented Interfaces:
IHashable, IOptionContainer, ISearchPath, ISimpleColumnContainer, ISimpleOptionContainer, IStatement
Direct Known Subclasses:
ChIndex, MsIndex, PgIndex

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.
  • 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
    • setClustered

      public void setClustered(boolean isClustered)
    • addColumn

      public void addColumn(SimpleColumn column)
      Description copied from interface: ISimpleColumnContainer
      Adds a column reference to this container.
      Specified by:
      addColumn in interface ISimpleColumnContainer
      Parameters:
      column - the simple column to add
    • compareColumns

      public boolean compareColumns(Collection<String> refs)
      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

      public void addInclude(String column)
      Description copied from interface: ISimpleColumnContainer
      Adds an included column to this container.
      Specified by:
      addInclude in interface ISimpleColumnContainer
      Parameters:
      column - the column name to include
    • isUnique

      public boolean isUnique()
    • setUnique

      public void setUnique(boolean unique)
    • setWhere

      public void setWhere(String where)
    • getTablespace

      public String getTablespace()
    • setTablespace

      public void setTablespace(String tableSpace)
    • getOptions

      public Map<String,String> getOptions()
      Description copied from interface: IOptionContainer
      Gets all options for this container.
      Specified by:
      getOptions in interface IOptionContainer
      Returns:
      a map of option keys to values
    • addOption

      public void addOption(String key, String value)
      Description copied from interface: IOptionContainer
      Adds an option to this container.
      Specified by:
      addOption in interface IOptionContainer
      Parameters:
      key - the option key
      value - the option value
    • 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 AbstractIndex 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
    • 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