org.datanucleus.store.rdbms.key
Class Index

java.lang.Object
  extended by org.datanucleus.store.rdbms.key.Index

public class Index
extends java.lang.Object

Representation of an index.


Field Summary
protected  java.util.List<org.datanucleus.store.mapped.DatastoreField> columns
          Columns that the key relates to.
protected  java.lang.String name
          Name of the key.
protected  org.datanucleus.store.mapped.DatastoreContainerObject table
          Table that the key applies to.
 
Constructor Summary
Index(CandidateKey ck)
          Constructor.
Index(org.datanucleus.store.mapped.DatastoreContainerObject table, boolean isUnique, java.lang.String extendedIndexSettings)
          Constructor.
Index(ForeignKey fk)
          Constructor.
 
Method Summary
 void addDatastoreField(org.datanucleus.store.mapped.DatastoreField col)
          Class to add a column to the key
protected  void assertSameDatastoreObject(org.datanucleus.store.mapped.DatastoreField col)
          Utility to assert if the column is for a different table.
 boolean equals(java.lang.Object obj)
          Equality operator.
 java.lang.String getColumnList()
          Accessor for the column list
static java.lang.String getColumnList(java.util.Collection cols)
          Method to return the list of columns which the key applies to.
 java.util.List getColumns()
          Accessor for the columns that the key relates to.
 org.datanucleus.store.mapped.DatastoreContainerObject getDatastoreContainerObject()
          Accessor for the table
 java.lang.String getExtendedIndexSettings()
          Extended index settings, mostly datastore proprietary settings
 java.lang.String getName()
          Accessor for the key name.
 boolean getUnique()
          Accessor for whether the index is unique
 int hashCode()
          Hashcode operator.
 void setColumn(int seq, Column col)
          Sets a column for in a specified position seq
protected static void setMinSize(java.util.List list, int size)
           
 void setName(java.lang.String name)
          Mutator for the key name.
 int size()
          Accessor for the size.
 boolean startsWith(org.datanucleus.store.rdbms.key.Key key)
          Check if this starts with the same columns specified in key.
 java.lang.String toString()
          Stringify method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Name of the key.


table

protected org.datanucleus.store.mapped.DatastoreContainerObject table
Table that the key applies to.


columns

protected java.util.List<org.datanucleus.store.mapped.DatastoreField> columns
Columns that the key relates to.

Constructor Detail

Index

public Index(org.datanucleus.store.mapped.DatastoreContainerObject table,
             boolean isUnique,
             java.lang.String extendedIndexSettings)
Constructor.

Parameters:
table - The table
isUnique - Whether the index is unique
extendedIndexSettings - extended index settings

Index

public Index(CandidateKey ck)
Constructor.

Parameters:
ck - Candidate key to use as a basis

Index

public Index(ForeignKey fk)
Constructor.

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.

setColumn

public void setColumn(int seq,
                      Column col)
Sets a column for in a specified position seq

Parameters:
seq - the specified position for the col
col - the Column

size

public int size()
Accessor for the size.

Returns:
The size.

hashCode

public int hashCode()
Hashcode operator.

Returns:
The hashcode

equals

public boolean equals(java.lang.Object obj)
Equality operator.

Parameters:
obj - Object to compare against
Returns:
Whether they are equal.

getExtendedIndexSettings

public java.lang.String getExtendedIndexSettings()
Extended index settings, mostly datastore proprietary settings

Returns:
the extended settings

toString

public java.lang.String toString()
Stringify method.

Overrides:
toString in class java.lang.Object
Returns:
String version of this object.

getName

public java.lang.String getName()
Accessor for the key name.

Returns:
Key name

getDatastoreContainerObject

public org.datanucleus.store.mapped.DatastoreContainerObject getDatastoreContainerObject()
Accessor for the table

Returns:
table

getColumns

public java.util.List getColumns()
Accessor for the columns that the key relates to.

Returns:
the List of columns.

getColumnList

public java.lang.String getColumnList()
Accessor for the column list

Returns:
The column list

addDatastoreField

public void addDatastoreField(org.datanucleus.store.mapped.DatastoreField col)
Class to add a column to the key

Parameters:
col - The column to add

startsWith

public boolean startsWith(org.datanucleus.store.rdbms.key.Key key)
Check if this starts with the same columns specified in key.

Parameters:
key - the Key (may be multiple number of columns)
Returns:
true if this columns starts with columns specified in key

setName

public void setName(java.lang.String name)
Mutator for the key name.

Parameters:
name - The key name

assertSameDatastoreObject

protected void assertSameDatastoreObject(org.datanucleus.store.mapped.DatastoreField col)
Utility to assert if the column is for a different table.

Parameters:
col - The column to compare with

setMinSize

protected static void setMinSize(java.util.List list,
                                 int size)

getColumnList

public static java.lang.String getColumnList(java.util.Collection cols)
Method to return the list of columns which the key applies to.

Parameters:
cols - The columns.
Returns:
The column list.


Copyright © 2009. All Rights Reserved.