Package com.sleepycat.bind.tuple
Class TupleTupleMarshalledKeyCreator<E extends MarshalledTupleEntry & MarshalledTupleKeyEntity>
java.lang.Object
com.sleepycat.bind.tuple.TupleBase<E>
com.sleepycat.bind.tuple.TupleTupleKeyCreator<E>
com.sleepycat.bind.tuple.TupleTupleMarshalledKeyCreator<E>
- All Implemented Interfaces:
ForeignKeyNullifier,SecondaryKeyCreator
public class TupleTupleMarshalledKeyCreator<E extends MarshalledTupleEntry & MarshalledTupleKeyEntity>
extends TupleTupleKeyCreator<E>
A concrete key creator that works in conjunction with a
TupleTupleMarshalledBinding. This key creator works by calling the
methods of the MarshalledTupleKeyEntity interface to create and
clear the index key.
Note that a marshalled tuple key creator is somewhat less efficient than a non-marshalled key tuple creator because more conversions are needed. A marshalled key creator must convert the entry to an object in order to create the key, while an unmarshalled key creator does not.
-
Constructor Summary
ConstructorsConstructorDescriptionTupleTupleMarshalledKeyCreator(TupleTupleMarshalledBinding<E> binding, String keyName) Creates a tuple-tuple marshalled key creator. -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateSecondaryKey(TupleInput primaryKeyInput, TupleInput dataInput, TupleOutput indexKeyOutput) Creates the index key from primary key tuple and data tuple.booleannullifyForeignKey(TupleInput dataInput, TupleOutput dataOutput) Clears the index key in the tuple data entry.Methods inherited from class com.sleepycat.bind.tuple.TupleTupleKeyCreator
createSecondaryKey, nullifyForeignKeyMethods inherited from class com.sleepycat.bind.tuple.TupleBase
entryToInput, getTupleBufferSize, getTupleOutput, inputToEntry, newOutput, newOutput, outputToEntry, setTupleBufferSize
-
Constructor Details
-
TupleTupleMarshalledKeyCreator
Creates a tuple-tuple marshalled key creator.- Parameters:
binding- is the binding used for the tuple-tuple entity.keyName- is the key name passed to theMarshalledTupleKeyEntity.marshalSecondaryKey(java.lang.String, com.sleepycat.bind.tuple.TupleOutput)method to identify the index key.
-
-
Method Details
-
createSecondaryKey
public boolean createSecondaryKey(TupleInput primaryKeyInput, TupleInput dataInput, TupleOutput indexKeyOutput) Description copied from class:TupleTupleKeyCreatorCreates the index key from primary key tuple and data tuple.- Specified by:
createSecondaryKeyin classTupleTupleKeyCreator<E extends MarshalledTupleEntry & MarshalledTupleKeyEntity>- Parameters:
primaryKeyInput- is theTupleInputfor the primary key entry.dataInput- is theTupleInputfor the data entry.indexKeyOutput- is the destination index key tuple.- Returns:
- true if a key was created, or false to indicate that the key is not present.
-
nullifyForeignKey
Description copied from class:TupleTupleKeyCreatorClears the index key in the tuple data entry. The dataInput should be read and then written to the dataOutput, clearing the index key in the process.The secondary key should be output or removed by this method such that
TupleTupleKeyCreator.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.- Overrides:
nullifyForeignKeyin classTupleTupleKeyCreator<E extends MarshalledTupleEntry & MarshalledTupleKeyEntity>- Parameters:
dataInput- is theTupleInputfor the data entry.dataOutput- is the destinationTupleOutput.- Returns:
- true if the key was cleared, or false to indicate that the key is not present and no change is necessary.
-