1 8 9 package com.sleepycat.bind; 10 11 import com.sleepycat.compat.DbCompat; 12 import com.sleepycat.je.DatabaseEntry; 13 14 23 public class RecordNumberBinding implements EntryBinding { 24 25 28 public RecordNumberBinding() { 29 } 30 31 public Object entryToObject(DatabaseEntry entry) { 33 34 return new Long (entryToRecordNumber(entry)); 35 } 36 37 public void objectToEntry(Object object, DatabaseEntry entry) { 39 40 recordNumberToEntry(((Number ) object).longValue(), entry); 41 } 42 43 51 public static long entryToRecordNumber(DatabaseEntry entry) { 52 53 return DbCompat.getRecordNumber(entry) & 0xFFFFFFFFL; 54 } 55 56 64 public static void recordNumberToEntry(long recordNumber, 65 DatabaseEntry entry) { 66 entry.setData(new byte[4], 0, 4); 67 DbCompat.setRecordNumber(entry, (int) recordNumber); 68 } 69 } 70 | Popular Tags |