00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.bind.serial;
00011
00012 import com.sleepycat.bind.EntityBinding;
00013 import com.sleepycat.db.DatabaseEntry;
00014
00031 public abstract class SerialSerialBinding implements EntityBinding {
00032
00033 private SerialBinding keyBinding;
00034 private SerialBinding dataBinding;
00035
00046 public SerialSerialBinding(ClassCatalog classCatalog,
00047 Class keyClass,
00048 Class dataClass) {
00049
00050 this(new SerialBinding(classCatalog, keyClass),
00051 new SerialBinding(classCatalog, dataClass));
00052 }
00053
00061 public SerialSerialBinding(SerialBinding keyBinding,
00062 SerialBinding dataBinding) {
00063
00064 this.keyBinding = keyBinding;
00065 this.dataBinding = dataBinding;
00066 }
00067
00068
00069 public Object entryToObject(DatabaseEntry key, DatabaseEntry data) {
00070
00071 return entryToObject(keyBinding.entryToObject(key),
00072 dataBinding.entryToObject(data));
00073 }
00074
00075
00076 public void objectToKey(Object object, DatabaseEntry key) {
00077
00078 object = objectToKey(object);
00079 keyBinding.objectToEntry(object, key);
00080 }
00081
00082
00083 public void objectToData(Object object, DatabaseEntry data) {
00084
00085 object = objectToData(object);
00086 dataBinding.objectToEntry(object, data);
00087 }
00088
00098 public abstract Object entryToObject(Object keyInput, Object dataInput);
00099
00107 public abstract Object objectToKey(Object object);
00108
00116 public abstract Object objectToData(Object object);
00117 }