|
Berkeley DB version 4.8.30 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.bind.serial.SerialSerialKeyCreator<PK,D,SK>
public abstract class SerialSerialKeyCreator<PK,D,SK>
A abstract key creator that uses a serial key and a serial data entry. This class takes care of serializing and deserializing the key and data entry automatically. The following abstract method must be implemented by a concrete subclass to create the index key using these objects
If ForeignKeyDeleteAction.NULLIFY
was
specified when opening the secondary database, the following method must be
overridden to nullify the foreign index key. If NULLIFY was not specified,
this method need not be overridden.
Field Summary | |
---|---|
protected SerialBinding<D> |
dataBinding
|
protected SerialBinding<SK> |
indexKeyBinding
|
protected SerialBinding<PK> |
primaryKeyBinding
|
Constructor Summary | |
---|---|
SerialSerialKeyCreator(ClassCatalog classCatalog,
Class<PK> primaryKeyClass,
Class<D> dataClass,
Class<SK> indexKeyClass)
Creates a serial-serial key creator. |
|
SerialSerialKeyCreator(SerialBinding<PK> primaryKeyBinding,
SerialBinding<D> dataBinding,
SerialBinding<SK> indexKeyBinding)
Creates a serial-serial entity binding. |
Method Summary | |
---|---|
abstract SK |
createSecondaryKey(PK primaryKey,
D data)
Creates the index key object from primary key and data objects. |
boolean |
createSecondaryKey(SecondaryDatabase db,
DatabaseEntry primaryKeyEntry,
DatabaseEntry dataEntry,
DatabaseEntry indexKeyEntry)
Creates a secondary key entry, given a primary key and data entry. |
D |
nullifyForeignKey(D data)
Clears the index key in a data object. |
boolean |
nullifyForeignKey(SecondaryDatabase db,
DatabaseEntry dataEntry)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SerialBinding<PK> primaryKeyBinding
protected SerialBinding<D> dataBinding
protected SerialBinding<SK> indexKeyBinding
Constructor Detail |
---|
public SerialSerialKeyCreator(ClassCatalog classCatalog, Class<PK> primaryKeyClass, Class<D> dataClass, Class<SK> indexKeyClass)
classCatalog
- is the catalog to hold shared class information and
for a database should be a StoredClassCatalog
.primaryKeyClass
- is the primary key base class.dataClass
- is the data base class.indexKeyClass
- is the index key base class.public SerialSerialKeyCreator(SerialBinding<PK> primaryKeyBinding, SerialBinding<D> dataBinding, SerialBinding<SK> indexKeyBinding)
primaryKeyBinding
- is the primary key binding.dataBinding
- is the data binding.indexKeyBinding
- is the index key binding.Method Detail |
---|
public boolean createSecondaryKey(SecondaryDatabase db, DatabaseEntry primaryKeyEntry, DatabaseEntry dataEntry, DatabaseEntry indexKeyEntry)
SecondaryKeyCreator
A secondary key may be derived from the primary key, primary data, or a combination of the primary key and data. For secondary keys that are optional, the key creator method may return false and the key/data pair will not be indexed. To ensure the integrity of a secondary database the key creator method must always return the same result for a given set of input parameters.
createSecondaryKey
in interface SecondaryKeyCreator
db
- the database to which the secondary key will be added.
This parameter is passed for informational purposes but is not commonly
used.
primaryKeyEntry
- the primary key entry. This parameter must not be modified
by this method.
dataEntry
- the primary data entry. This parameter must not be modified
by this method.
indexKeyEntry
- the secondary key created by this method.
public boolean nullifyForeignKey(SecondaryDatabase db, DatabaseEntry dataEntry)
nullifyForeignKey
in interface ForeignKeyNullifier
public abstract SK createSecondaryKey(PK primaryKey, D data)
primaryKey
- is the deserialized source primary key entry, or
null if no primary key entry is used to construct the index key.data
- is the deserialized source data entry, or null if no
data entry is used to construct the index key.
public D nullifyForeignKey(D data)
On entry the data parameter contains the index key to be cleared. It
should be changed by this method such that createSecondaryKey(com.sleepycat.db.SecondaryDatabase, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)
will return false. Other fields in the data object should remain
unchanged.
data
- is the source and destination data object.
|
Berkeley DB version 4.8.30 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |