Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

TupleSerialBinding.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2000-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: TupleSerialBinding.java,v 12.2 2005/08/01 20:25:08 mark Exp $
00008  */
00009 
00010 package com.sleepycat.bind.serial;
00011 
00012 import com.sleepycat.bind.EntityBinding;
00013 import com.sleepycat.bind.tuple.TupleBase;
00014 import com.sleepycat.bind.tuple.TupleInput;
00015 import com.sleepycat.bind.tuple.TupleOutput;
00016 import com.sleepycat.db.DatabaseEntry;
00017 
00034 public abstract class TupleSerialBinding extends TupleBase
00035     implements EntityBinding {
00036 
00037     protected SerialBinding dataBinding;
00038 
00047     public TupleSerialBinding(ClassCatalog classCatalog,
00048                               Class baseClass) {
00049 
00050         this(new SerialBinding(classCatalog, baseClass));
00051     }
00052 
00058     public TupleSerialBinding(SerialBinding dataBinding) {
00059 
00060         this.dataBinding = dataBinding;
00061     }
00062 
00063     // javadoc is inherited
00064     public Object entryToObject(DatabaseEntry key, DatabaseEntry data) {
00065 
00066         return entryToObject(entryToInput(key),
00067                              dataBinding.entryToObject(data));
00068     }
00069 
00070     // javadoc is inherited
00071     public void objectToKey(Object object, DatabaseEntry key) {
00072 
00073         TupleOutput output = getTupleOutput(object);
00074         objectToKey(object, output);
00075         outputToEntry(output, key);
00076     }
00077 
00078     // javadoc is inherited
00079     public void objectToData(Object object, DatabaseEntry data) {
00080 
00081         object = objectToData(object);
00082         dataBinding.objectToEntry(object, data);
00083     }
00084 
00095     public abstract Object entryToObject(TupleInput keyInput,
00096                                          Object dataInput);
00097 
00106     public abstract void objectToKey(Object object, TupleOutput keyOutput);
00107 
00115     public abstract Object objectToData(Object object);
00116 }

Generated on Sun Dec 25 12:14:30 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2