DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Berkeley DB
version 4.4.20

com.sleepycat.bind.serial
Class TupleSerialMarshalledBinding

java.lang.Object
  extended bycom.sleepycat.bind.tuple.TupleBase
      extended bycom.sleepycat.bind.serial.TupleSerialBinding
          extended bycom.sleepycat.bind.serial.TupleSerialMarshalledBinding
All Implemented Interfaces:
EntityBinding

public class TupleSerialMarshalledBinding
extends TupleSerialBinding

A concrete TupleSerialBinding that delegates to the MarshalledTupleKeyEntity interface of the entity class.

The MarshalledTupleKeyEntity interface must be implemented by the entity class to convert between the key/data entry and entity object.

The binding is "tricky" in that it uses the entity class for both the stored data entry and the combined entity object. To do this, the entity's key field(s) are transient and are set by the binding after the data object has been deserialized. This avoids the use of a "data" class completely.

See Also:
MarshalledTupleKeyEntity

Field Summary
 
Fields inherited from class com.sleepycat.bind.serial.TupleSerialBinding
dataBinding
 
Constructor Summary
TupleSerialMarshalledBinding(ClassCatalog classCatalog, Class baseClass)
          Creates a tuple-serial marshalled binding object.
TupleSerialMarshalledBinding(SerialBinding dataBinding)
          Creates a tuple-serial marshalled binding object.
 
Method Summary
 Object entryToObject(TupleInput tupleInput, Object javaInput)
          Constructs an entity object from TupleInput key entry and deserialized data entry objects.
 Object objectToData(Object object)
          Extracts a data object from an entity object.
 void objectToKey(Object object, TupleOutput output)
          Extracts a key tuple from an entity object.
 
Methods inherited from class com.sleepycat.bind.serial.TupleSerialBinding
entryToObject, objectToData, objectToKey
 
Methods inherited from class com.sleepycat.bind.tuple.TupleBase
entryToInput, getTupleBufferSize, getTupleOutput, inputToEntry, newOutput, newOutput, outputToEntry, setTupleBufferSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleSerialMarshalledBinding

public TupleSerialMarshalledBinding(ClassCatalog classCatalog,
                                    Class baseClass)
Creates a tuple-serial marshalled binding object.

Parameters:
classCatalog - is the catalog to hold shared class information and for a database should be a StoredClassCatalog.
baseClass - is the base class for serialized objects stored using this binding -- all objects using this binding must be an instance of this class.

TupleSerialMarshalledBinding

public TupleSerialMarshalledBinding(SerialBinding dataBinding)
Creates a tuple-serial marshalled binding object.

Parameters:
dataBinding - is the binding used for serializing and deserializing the entity object.
Method Detail

entryToObject

public Object entryToObject(TupleInput tupleInput,
                            Object javaInput)
Description copied from class: TupleSerialBinding
Constructs an entity object from TupleInput key entry and deserialized data entry objects.

Specified by:
entryToObject in class TupleSerialBinding
Parameters:
tupleInput - is the TupleInput key entry object.
javaInput - is the deserialized data entry object.
Returns:
the entity object constructed from the key and data.

objectToKey

public void objectToKey(Object object,
                        TupleOutput output)
Description copied from class: TupleSerialBinding
Extracts a key tuple from an entity object.

Specified by:
objectToKey in class TupleSerialBinding
Parameters:
object - is the entity object.
output - is the TupleOutput to which the key should be written.

objectToData

public Object objectToData(Object object)
Description copied from class: TupleSerialBinding
Extracts a data object from an entity object.

Specified by:
objectToData in class TupleSerialBinding
Parameters:
object - is the entity object.
Returns:
the deserialized data object.

Berkeley DB
version 4.4.20

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