Package org.datanucleus.store.rdbms.key
Class Index
- java.lang.Object
-
- org.datanucleus.store.rdbms.key.ColumnOrderedKey
-
- org.datanucleus.store.rdbms.key.Index
-
public class Index extends ColumnOrderedKey
Representation of an INDEX.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Column>columnsColumns that the key relates to.static StringEXTENSION_INDEX_EXTENDED_SETTINGstatic StringEXTENSION_INDEX_TYPEprotected StringnameName of the key.protected TabletableTable that the key applies to.-
Fields inherited from class org.datanucleus.store.rdbms.key.ColumnOrderedKey
columnOrdering, extensions
-
-
Constructor Summary
Constructors Constructor Description Index(CandidateKey ck)Constructor for an index for the specified candidate key.Index(ForeignKey fk)Constructor for an index for the specified foreign key.Index(Table table, boolean isUnique, Map<String,String> extensions)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertSameDatastoreObject(Column col)Utility to assert if the column is for a different table.booleanequals(Object obj)Equality operator.StringgetColumnList()Accessor for the column liststatic StringgetColumnList(List<Column> cols)Method to return the list of columns which the key applies to.List<Column>getColumns()Accessor for the columns that the key relates to.StringgetName()Accessor for the key name.intgetNumberOfColumns()Accessor for the number of columns.TablegetTable()Accessor for the tablebooleangetUnique()Accessor for whether the index is uniqueinthashCode()Hashcode operator.protected static voidsetListMinimumSize(List list, int size)voidsetName(String name)Mutator for the key name.StringtoString()Stringify method.-
Methods inherited from class org.datanucleus.store.rdbms.key.ColumnOrderedKey
addColumn, getColumnList, getValueForExtension, setColumn, setColumnOrdering
-
-
-
-
Field Detail
-
EXTENSION_INDEX_EXTENDED_SETTING
public static final String EXTENSION_INDEX_EXTENDED_SETTING
- See Also:
- Constant Field Values
-
EXTENSION_INDEX_TYPE
public static final String EXTENSION_INDEX_TYPE
- See Also:
- Constant Field Values
-
name
protected String name
Name of the key.
-
table
protected Table table
Table that the key applies to.
-
-
Constructor Detail
-
Index
public Index(Table table, boolean isUnique, Map<String,String> extensions)
Constructor.- Parameters:
table- The tableisUnique- Whether the index is uniqueextensions- Any extensions for the index
-
Index
public Index(CandidateKey ck)
Constructor for an index for the specified candidate key.- Parameters:
ck- Candidate key to use as a basis
-
Index
public Index(ForeignKey fk)
Constructor for an index for the specified foreign key.- Parameters:
fk- Foreign key to use as a basis
-
-
Method Detail
-
getUnique
public boolean getUnique()
Accessor for whether the index is unique- Returns:
- Whether it is unique.
-
hashCode
public int hashCode()
Hashcode operator.- Returns:
- The hashcode
-
equals
public boolean equals(Object obj)
Equality operator.- Parameters:
obj- Object to compare against- Returns:
- Whether they are equal.
-
toString
public String toString()
Stringify method. Generates a form of the index ready to be used in a DDL statement. e.gINDEX (col1, col2)
-
setName
public void setName(String name)
Mutator for the key name.- Parameters:
name- The key name
-
getName
public String getName()
Accessor for the key name.- Returns:
- Key name
-
getTable
public Table getTable()
Accessor for the table- Returns:
- table
-
getColumns
public List<Column> getColumns()
Accessor for the columns that the key relates to.- Returns:
- the List of columns.
-
getColumnList
public String getColumnList()
Accessor for the column list- Returns:
- The column list
-
getNumberOfColumns
public int getNumberOfColumns()
Accessor for the number of columns.- Returns:
- The number of columns.
-
assertSameDatastoreObject
protected void assertSameDatastoreObject(Column col)
Utility to assert if the column is for a different table.- Parameters:
col- The column to compare with
-
setListMinimumSize
protected static void setListMinimumSize(List list, int size)
-
-