Berkeley DB
version 4.2.52

com.sleepycat.bdb.bind.tuple
Class TupleMarshalledBinding

java.lang.Object
  |
  +--com.sleepycat.bdb.bind.tuple.TupleBinding
        |
        +--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.


Constructor Summary
TupleMarshalledBinding(TupleFormat format, Class cls)
          Creates a tuple marshalled binding object.
 
Method Summary
 Object dataToObject(TupleInput input)
          Constructs a key or value object from TupleInput data.
 void objectToData(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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleMarshalledBinding

public TupleMarshalledBinding(TupleFormat format,
                              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 Object dataToObject(TupleInput input)
                    throws 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.
IOException

objectToData

public void objectToData(Object object,
                         TupleOutput output)
                  throws 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.
IOException

Berkeley DB
version 4.2.52

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