com.sleepycat.bind.serial

Class TupleSerialBinding

public abstract class TupleSerialBinding extends TupleBase implements EntityBinding

An abstract EntityBinding that treats an entity's key entry as a tuple and its data entry as a serialized object.

This class takes care of serializing and deserializing the data entry, and converting the key entry to/from TupleInput and TupleOutput objects. Its three abstract methods must be implemented by a concrete subclass to convert these objects to/from an entity object.

Field Summary
protected SerialBindingdataBinding
Constructor Summary
TupleSerialBinding(ClassCatalog classCatalog, Class baseClass)
Creates a tuple-serial entity binding.
TupleSerialBinding(SerialBinding dataBinding)
Creates a tuple-serial entity binding.
Method Summary
ObjectentryToObject(DatabaseEntry key, DatabaseEntry data)
abstract ObjectentryToObject(TupleInput keyInput, Object dataInput)
Constructs an entity object from TupleInput key entry and deserialized data entry objects.
voidobjectToData(Object object, DatabaseEntry data)
abstract ObjectobjectToData(Object object)
Extracts a data object from an entity object.
voidobjectToKey(Object object, DatabaseEntry key)
abstract voidobjectToKey(Object object, TupleOutput keyOutput)
Extracts a key tuple from an entity object.

Field Detail

dataBinding

protected SerialBinding dataBinding

Constructor Detail

TupleSerialBinding

public TupleSerialBinding(ClassCatalog classCatalog, Class baseClass)
Creates a tuple-serial entity binding.

Parameters: classCatalog is the catalog to hold shared class information and for a database should be a StoredClassCatalog. baseClass is the base class.

TupleSerialBinding

public TupleSerialBinding(SerialBinding dataBinding)
Creates a tuple-serial entity binding.

Parameters: dataBinding is the data binding.

Method Detail

entryToObject

public Object entryToObject(DatabaseEntry key, DatabaseEntry data)

entryToObject

public abstract Object entryToObject(TupleInput keyInput, Object dataInput)
Constructs an entity object from TupleInput key entry and deserialized data entry objects.

Parameters: keyInput is the TupleInput key entry object. dataInput is the deserialized data entry object.

Returns: the entity object constructed from the key and data.

objectToData

public void objectToData(Object object, DatabaseEntry data)

objectToData

public abstract Object objectToData(Object object)
Extracts a data object from an entity object.

Parameters: object is the entity object.

Returns: the deserialized data object.

objectToKey

public void objectToKey(Object object, DatabaseEntry key)

objectToKey

public abstract void objectToKey(Object object, TupleOutput keyOutput)
Extracts a key tuple from an entity object.

Parameters: object is the entity object. keyOutput is the TupleOutput to which the key should be written.