Berkeley DB
version 4.8.30

com.sleepycat.bind.tuple
Class TupleMarshalledBinding<E extends MarshalledTupleEntry>

java.lang.Object
  extended by com.sleepycat.bind.tuple.TupleBase<E>
      extended by com.sleepycat.bind.tuple.TupleBinding<E>
          extended by com.sleepycat.bind.tuple.TupleMarshalledBinding<E>
All Implemented Interfaces:
EntryBinding<E>

public class TupleMarshalledBinding<E extends MarshalledTupleEntry>
extends TupleBinding<E>

A concrete TupleBinding that delegates to the MarshalledTupleEntry interface of the data or key object.

This class works by calling the methods of the MarshalledTupleEntry interface, which must be implemented by the key or data class, to convert between the key or data entry and the object.


Constructor Summary
TupleMarshalledBinding(Class<E> cls)
          Creates a tuple marshalled binding object.
 
Method Summary
 E entryToObject(TupleInput input)
          Constructs a key or data object from a TupleInput entry.
 void objectToEntry(E object, TupleOutput output)
          Converts a key or data object to a tuple entry.
 
Methods inherited from class com.sleepycat.bind.tuple.TupleBinding
entryToObject, getPrimitiveBinding, objectToEntry
 
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

TupleMarshalledBinding

public TupleMarshalledBinding(Class<E> cls)
Creates a tuple marshalled binding object.

The given class is used to instantiate key or data 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 MarshalledTupleEntry interface.

Parameters:
cls - is the class of the key or data objects.
Method Detail

entryToObject

public E entryToObject(TupleInput input)
Description copied from class: TupleBinding
Constructs a key or data object from a TupleInput entry.

Specified by:
entryToObject in class TupleBinding<E extends MarshalledTupleEntry>
Parameters:
input - is the tuple key or data entry.
Returns:
the key or data object constructed from the entry.

objectToEntry

public void objectToEntry(E object,
                          TupleOutput output)
Description copied from class: TupleBinding
Converts a key or data object to a tuple entry.

Specified by:
objectToEntry in class TupleBinding<E extends MarshalledTupleEntry>
Parameters:
object - is the key or data object.
output - is the tuple entry to which the key or data should be written.

Berkeley DB
version 4.8.30

Copyright (c) 1996-2009 Oracle. All rights reserved.