Berkeley DB
version 4.2.52

com.sleepycat.bdb.bind.serial
Class TupleSerialMarshalledBinding

java.lang.Object
  |
  +--com.sleepycat.bdb.bind.serial.TupleSerialBinding
        |
        +--com.sleepycat.bdb.bind.serial.TupleSerialMarshalledBinding
All Implemented Interfaces:
EntityBinding

public class TupleSerialMarshalledBinding
extends TupleSerialBinding

A concrete entity binding that uses the MarshalledTupleKeyEntity interface. It works by calling the methods of the MarshalledTupleKeyEntity interface, which must be implemented by the entity class, to convert between the key/value data and entity object.

The binding is "tricky" in that it uses the entity class for both the stored data value 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 "value" class completely.

See Also:
MarshalledTupleKeyEntity

Constructor Summary
TupleSerialMarshalledBinding(TupleFormat keyFormat, SerialFormat valueFormat)
          Creates a tuple-serial marshalled binding object.
 
Method Summary
 Object dataToObject(TupleInput tupleInput, Object javaInput)
          Constructs an entity object from TupleInput key data and deserialized value data objects.
 void objectToKey(Object object, TupleOutput output)
          Extracts a key tuple from an entity object.
 Object objectToValue(Object object)
          Extracts a value object from an entity object.
 
Methods inherited from class com.sleepycat.bdb.bind.serial.TupleSerialBinding
dataToObject, getKeyFormat, getValueFormat, objectToKey, objectToValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleSerialMarshalledBinding

public TupleSerialMarshalledBinding(TupleFormat keyFormat,
                                    SerialFormat valueFormat)
Creates a tuple-serial marshalled binding object.

Parameters:
keyFormat - is the key data format.
valueFormat - is the value data format.
Method Detail

dataToObject

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

Specified by:
dataToObject in class TupleSerialBinding
Parameters:
tupleInput - is the TupleInput key data object.
javaInput - is the deserialized value data object.
Returns:
the entity object constructed from the key and value.
Throws:
IOException - if data cannot be read or written.

objectToKey

public void objectToKey(Object object,
                        TupleOutput output)
                 throws IOException
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.
Throws:
IOException - if data cannot be read or written.

objectToValue

public Object objectToValue(Object object)
                     throws IOException
Description copied from class: TupleSerialBinding
Extracts a value object from an entity object.

Specified by:
objectToValue in class TupleSerialBinding
Parameters:
object - is the entity object.
Returns:
the deserialized value data object.
Throws:
IOException - if data cannot be read or written.

Berkeley DB
version 4.2.52

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