Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.3.29
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.bind.serial
Class SerialSerialKeyCreator

    java.lang.Object
      com.sleepycat.bind.serial.SerialSerialKeyCreator

All Implemented Interfaces:
  SecondaryKeyCreator

public abstract class SerialSerialKeyCreator
extends Object
implements SecondaryKeyCreator

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

- `createSecondaryKey(Object,Object)`

Constructor Summary
`SerialSerialKeyCreator(ClassCatalog classCatalog, Class primaryKeyClass, Class dataClass, Class indexKeyClass)` Creates a serial-serial key creator.
`SerialSerialKeyCreator(SerialBinding primaryKeyBinding, SerialBinding dataBinding, SerialBinding indexKeyBinding)` Creates a serial-serial entity binding.

Method Summary
`abstract Object` | `createSecondaryKey(Object primaryKey, Object data)` Creates the index key object from primary key and entry objects.
`boolean` | `createSecondaryKey(SecondaryDatabase db, DatabaseEntry primaryKeyEntry, DatabaseEntry dataEntry, DatabaseEntry indexKeyEntry)` Creates a secondary key entry, given a primary key and data entry.
`Object` | `nullifyForeignKey(Object data)` Clears the index key in a data object.
`boolean` | `nullifyForeignKey(SecondaryDatabase db, DatabaseEntry dataEntry)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SerialSerialKeyCreator

    public SerialSerialKeyCreator(ClassCatalog classCatalog,
                                  Class primaryKeyClass,
                                  Class dataClass,
                                  Class indexKeyClass)

  Creates a serial-serial key creator.

Parameters:
  `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.

### SerialSerialKeyCreator

    public SerialSerialKeyCreator(SerialBinding primaryKeyBinding,
                                  SerialBinding dataBinding,
                                  SerialBinding indexKeyBinding)

  Creates a serial-serial entity binding.

Parameters:
  `primaryKeyBinding` - is the primary key binding.
  `dataBinding` - is the data binding.
  `indexKeyBinding` - is the index key binding.

Method Detail

### createSecondaryKey

    public boolean createSecondaryKey(SecondaryDatabase db,
                                      DatabaseEntry primaryKeyEntry,
                                      DatabaseEntry dataEntry,
                                      DatabaseEntry indexKeyEntry)
                               throws DatabaseException

  Description copied from interface: `SecondaryKeyCreator`
  Creates a secondary key entry, given a primary key and data entry.

  Specified by:
    `createSecondaryKey` in interface `SecondaryKeyCreator`
  Parameters:
    `db` - the database to which the secondary key will be added.

    `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.

  Returns:
    true if a key was created, or false to indicate that the key is not present.

  Throws:
    `DatabaseException` - if an error occurs attempting to create the secondary key.

### nullifyForeignKey

    public boolean nullifyForeignKey(SecondaryDatabase db,
                                     DatabaseEntry dataEntry)
                              throws DatabaseException

  Throws:
    `DatabaseException`

### createSecondaryKey

    public abstract Object createSecondaryKey(Object primaryKey,
                                              Object data)

  Creates the index key object from primary key and entry objects.

  Parameters:
    `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.
  Returns:
    the destination index key object, or null to indicate that the key is not present.

### nullifyForeignKey

    public Object nullifyForeignKey(Object data)

  Clears the index key in a data object.

  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.

  Parameters:
    `data` - is the source and destination data object.
  Returns:
    the destination data object, or null to indicate that the key is not present and no change is necessary. The data returned may be the same object passed as the data parameter or a newly created object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.3.29
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.