Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.8.24
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.bind.serial
Class TupleSerialBinding<D,E>

    java.lang.Object
      com.sleepycat.bind.tuple.TupleBase
          com.sleepycat.bind.serial.TupleSerialBinding<D,E>

All Implemented Interfaces:
  EntityBinding<E>

Direct Known Subclasses:
  TupleSerialMarshalledBinding

    public abstract class TupleSerialBinding<D,E>

extends TupleBase
implements EntityBinding<E>

An abstract `EntityBinding` that treats an entity's key entry as a tuple and its data entry as a serialized object.

This class takes care of serializing and deserializing the data entry, and converting the key entry to/from `TupleInput` and `TupleOutput` objects. Its three abstract methods must be implemented by a concrete subclass to convert these objects to/from an entity object.

- `entryToObject(TupleInput,Object)`
- `objectToKey(Object,TupleOutput)`
- `objectToData(Object)`

See Also:
  Class Evolution

Field Summary
`protected SerialBinding<D>` | `dataBinding`

Constructor Summary
`TupleSerialBinding(ClassCatalog classCatalog, Class<D> baseClass)` Creates a tuple-serial entity binding.
`TupleSerialBinding(SerialBinding<D> dataBinding)` Creates a tuple-serial entity binding.

Method Summary
`E` | `entryToObject(DatabaseEntry key, DatabaseEntry data)` Converts key and data entry buffers into an entity Object.
`abstract E` | `entryToObject(TupleInput keyInput, D dataInput)` Constructs an entity object from `TupleInput` key entry and deserialized data entry objects.
`abstract D` | `objectToData(E object)` Extracts a data object from an entity object.
`void` | `objectToData(E object, DatabaseEntry data)` Extracts the data entry from an entity Object.
`void` | `objectToKey(E object, DatabaseEntry key)` Extracts the key entry from an entity Object.
`abstract void` | `objectToKey(E object, TupleOutput keyOutput)` Extracts a key tuple from an entity object.

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`

Field Detail

### dataBinding

    protected SerialBinding<D> dataBinding

Constructor Detail

### TupleSerialBinding

    public TupleSerialBinding(ClassCatalog classCatalog,
                              Class<D> baseClass)

  Creates a tuple-serial entity binding.

  Parameters:
    `classCatalog` - is the catalog to hold shared class information and for a database should be a `StoredClassCatalog`.
    `baseClass` - is the base class.

### TupleSerialBinding

    public TupleSerialBinding(SerialBinding<D> dataBinding)

  Creates a tuple-serial entity binding.

  Parameters:
    `dataBinding` - is the data binding.

Method Detail

### entryToObject

    public E entryToObject(DatabaseEntry key,
                           DatabaseEntry data)

  Description copied from interface: `EntityBinding`
  Converts key and data entry buffers into an entity Object.

  Specified by:
    `entryToObject` in interface `EntityBinding<E>`
  Parameters:
    `key` - is the source key entry.
    `data` - is the source data entry.
  Returns:
    the resulting Object.

### objectToKey

    public void objectToKey(E object,
                            DatabaseEntry key)

  Description copied from interface: `EntityBinding`
  Extracts the key entry from an entity Object.

  Specified by:
    `objectToKey` in interface `EntityBinding<E>`
  Parameters:
    `object` - is the source Object.
    `key` - is the destination entry buffer.

### objectToData

    public void objectToData(E object,
                             DatabaseEntry data)

  Description copied from interface: `EntityBinding`
  Extracts the data entry from an entity Object.

  Specified by:
    `objectToData` in interface `EntityBinding<E>`
  Parameters:
    `object` - is the source Object.
    `data` - is the destination entry buffer.

### entryToObject

    public abstract E entryToObject(TupleInput keyInput,
                                    D dataInput)

  Constructs an entity object from `TupleInput` key entry and deserialized data entry objects.

  Parameters:
    `keyInput` - is the `TupleInput` key entry object.
    `dataInput` - is the deserialized data entry object.
  Returns:
    the entity object constructed from the key and data.

### objectToKey

    public abstract void objectToKey(E object,
                                     TupleOutput keyOutput)

  Extracts a key tuple from an entity object.

  Parameters:
    `object` - is the entity object.
    `keyOutput` - is the `TupleOutput` to which the key should be written.

### objectToData

    public abstract D objectToData(E object)

  Extracts a data object from an entity object.

  Parameters:
    `object` - is the entity object.
  Returns:
    the deserialized data object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.8.24
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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