|
Berkeley DB version 4.8.30 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.bind.tuple.TupleBase<E> com.sleepycat.bind.tuple.TupleBinding<E>
public abstract class TupleBinding<E>
An abstract 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.
For key or data entries which are Java primitive classes (String,
Integer, etc) getPrimitiveBinding(java.lang.Class
may be used to return a built in
tuple binding. A custom tuple binding for these types is not needed.
Note: getPrimitiveBinding(java.lang.Class
returns bindings that do not
sort negative floating point numbers correctly by default. See SortedFloatBinding
and SortedDoubleBinding
for details.
When a tuple binding is used as a key binding, it produces key values
with a reasonable default sort order. For more information on the default
sort order, see TupleOutput
.
Constructor Summary | |
---|---|
TupleBinding()
Creates a tuple binding. |
Method Summary | ||
---|---|---|
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
|
getPrimitiveBinding(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. |
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 |
---|
public TupleBinding()
Method Detail |
---|
public E entryToObject(DatabaseEntry entry)
EntryBinding
entryToObject
in interface EntryBinding<E>
entry
- is the source entry buffer.
public void objectToEntry(E object, DatabaseEntry entry)
EntryBinding
objectToEntry
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(Class<T> cls)
String
Character
Boolean
Byte
Short
Integer
Long
Float
Double
Note: getPrimitiveBinding(java.lang.Class
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.
|
Berkeley DB version 4.8.30 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |