1 8 9 package com.sleepycat.bind.serial; 10 11 import com.sleepycat.bind.EntityBinding; 12 import com.sleepycat.bind.tuple.TupleBase; 13 import com.sleepycat.bind.tuple.TupleInput; 14 import com.sleepycat.bind.tuple.TupleOutput; 15 import com.sleepycat.je.DatabaseEntry; 16 17 33 public abstract class TupleSerialBinding extends TupleBase 34 implements EntityBinding { 35 36 protected SerialBinding dataBinding; 37 38 46 public TupleSerialBinding(ClassCatalog classCatalog, 47 Class baseClass) { 48 49 this(new SerialBinding(classCatalog, baseClass)); 50 } 51 52 57 public TupleSerialBinding(SerialBinding dataBinding) { 58 59 this.dataBinding = dataBinding; 60 } 61 62 public Object entryToObject(DatabaseEntry key, DatabaseEntry data) { 64 65 return entryToObject(entryToInput(key), 66 dataBinding.entryToObject(data)); 67 } 68 69 public void objectToKey(Object object, DatabaseEntry key) { 71 72 TupleOutput output = getTupleOutput(object); 73 objectToKey(object, output); 74 outputToEntry(output, key); 75 } 76 77 public void objectToData(Object object, DatabaseEntry data) { 79 80 object = objectToData(object); 81 dataBinding.objectToEntry(object, data); 82 } 83 84 94 public abstract Object entryToObject(TupleInput keyInput, 95 Object dataInput); 96 97 105 public abstract void objectToKey(Object object, TupleOutput keyOutput); 106 107 114 public abstract Object objectToData(Object object); 115 } 116 | Popular Tags |