com.sleepycat.bdb.bind.tuple
Class TupleMarshalledBinding

java.lang.Object
  extended by com.sleepycat.bdb.bind.tuple.TupleBinding
      extended by com.sleepycat.bdb.bind.tuple.TupleMarshalledBinding
All Implemented Interfaces:
DataBinding

public class TupleMarshalledBinding
extends TupleBinding

A concrete key or value binding that uses the MarshalledTupleData interface. It works by calling the methods of the MarshalledTupleData interface, which must be implemented by the key or value class, to convert between the key or value data and the object. use the TupleInput.TupleInput(TupleOutput) constructor.


Field Summary
 
Fields inherited from class com.sleepycat.bdb.bind.tuple.TupleBinding
format
 
Constructor Summary
TupleMarshalledBinding(TupleFormat format, java.lang.Class cls)
          Creates a tuple marshalled binding object.
 
Method Summary
 java.lang.Object dataToObject(TupleInput input)
          Constructs a key or value object from TupleInput data.
 void objectToData(java.lang.Object object, TupleOutput output)
          Converts a key or value object to a tuple data.
 
Methods inherited from class com.sleepycat.bdb.bind.tuple.TupleBinding
dataToObject, getDataFormat, getPrimitiveBinding, objectToData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleMarshalledBinding

public TupleMarshalledBinding(TupleFormat format,
                              java.lang.Class cls)
Creates a tuple marshalled binding object.

The given class is used to instantiate key or value objects using Class.forName(java.lang.String), and therefore must be a public class and have a public no-arguments constructor. It must also implement the MarshalledTupleData interface.

Parameters:
format - is the format of the new binding.
cls - is the class of the key or value objects.
Method Detail

dataToObject

public java.lang.Object dataToObject(TupleInput input)
                              throws java.io.IOException
Description copied from class: TupleBinding
Constructs a key or value object from TupleInput data.

Specified by:
dataToObject in class TupleBinding
Parameters:
input - is the tuple key or value data.
Returns:
the key or value object constructed from the data.
Throws:
java.io.IOException

objectToData

public void objectToData(java.lang.Object object,
                         TupleOutput output)
                  throws java.io.IOException
Description copied from class: TupleBinding
Converts a key or value object to a tuple data.

Specified by:
objectToData in class TupleBinding
Parameters:
object - is the key or value object.
output - is the tuple data to which the key or value should be written.
Throws:
java.io.IOException