public abstract class TupleBinding<E> extends TupleBase<E> implements EntryBinding<E>
EntryBinding that treats a key or data entry as a
tuple; it includes predefined bindings for Java primitive types.
This class takes care of converting the entries to/from TupleInput and TupleOutput objects. Its two abstract methods must
be implemented by a concrete subclass to convert between tuples and key or
data objects.
| Constructor and Description |
|---|
TupleBinding()
Creates a tuple binding.
|
| Modifier and Type | Method and Description |
|---|---|
E |
entryToObject(DatabaseEntry entry)
Converts a entry buffer into an Object.
|
abstract E |
entryToObject(TupleInput input)
Constructs a key or data object from a
TupleInput entry. |
static <T> TupleBinding<T> |
getPrimitiveBinding(java.lang.Class<T> cls)
Creates a tuple binding for a primitive Java class.
|
void |
objectToEntry(E object,
DatabaseEntry entry)
Converts an Object into a entry buffer.
|
abstract void |
objectToEntry(E object,
TupleOutput output)
Converts a key or data object to a tuple entry.
|
entryToInput, getTupleBufferSize, getTupleOutput, inputToEntry, newOutput, newOutput, outputToEntry, setTupleBufferSizepublic E entryToObject(DatabaseEntry entry)
EntryBindingentryToObject in interface EntryBinding<E>entry - is the source entry buffer.public void objectToEntry(E object, DatabaseEntry entry)
EntryBindingobjectToEntry in interface EntryBinding<E>object - is the source Object.entry - is the destination entry buffer.public abstract E entryToObject(TupleInput input)
TupleInput entry.input - is the tuple key or data entry.public abstract void objectToEntry(E object, TupleOutput output)
object - is the key or data object.output - is the tuple entry to which the key or data should be
written.public static <T> TupleBinding<T> getPrimitiveBinding(java.lang.Class<T> cls)
StringCharacterBooleanByteShortIntegerLongFloatDoubleNote: getPrimitiveBinding(java.lang.Class<T>) returns bindings that do
not sort negative floating point numbers correctly by default. See
SortedFloatBinding and SortedDoubleBinding for
details.
cls - is the primitive Java class.Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.