Package org.datanucleus.store.rdbms.key
Class CandidateKey
- java.lang.Object
-
- org.datanucleus.store.rdbms.key.ColumnOrderedKey
-
- org.datanucleus.store.rdbms.key.CandidateKey
-
- Direct Known Subclasses:
PrimaryKey
public class CandidateKey extends ColumnOrderedKey
Representation of a Candidate key. This represents a UNIQUE candidate key on a column or columns.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Column>columnsColumns that the key relates to.protected 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 CandidateKey(Table table, 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.TablegetTable()Accessor for the tableinthashCode()Hashcode operator.protected static voidsetMinSize(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
-
-
-
-
Method Detail
-
equals
public boolean equals(Object obj)
Equality operator.- Parameters:
obj- Object to compare against- Returns:
- Whether they are equal.
-
hashCode
public int hashCode()
Hashcode operator.- Returns:
- The hashcode
-
toString
public String toString()
Stringify method. ReturnsUNIQUE (col1, ...)
.
-
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
-
assertSameDatastoreObject
protected void assertSameDatastoreObject(Column col)
Utility to assert if the column is for a different table.- Parameters:
col- The column to compare with
-
setMinSize
protected static void setMinSize(List list, int size)
-
-