1 9 10 package com.sleepycat.je.utilint; 11 12 import com.sleepycat.je.DatabaseEntry; 13 14 17 public class DatabaseUtil { 18 19 22 static public void checkForNullParam(Object param, String name) { 23 if (param == null) { 24 throw new NullPointerException (name + " cannot be null"); 25 } 26 } 27 28 31 static public void checkForNullDbt(DatabaseEntry dbt, 32 String name, 33 boolean checkData) { 34 if (dbt == null) { 35 throw new NullPointerException 36 ("DatabaseEntry " + name + " cannot be null"); 37 } 38 39 if (checkData) { 40 if (dbt.getData() == null) { 41 throw new NullPointerException 42 ("Data field for DatabaseEntry " + 43 name + " cannot be null"); 44 } 45 } 46 } 47 48 52 static public void checkForPartialKey(DatabaseEntry dbt) { 53 if (dbt.getPartial()) { 54 throw new IllegalArgumentException 55 ("A partial key DatabaseEntry is not allowed"); 56 } 57 } 58 } 59 | Popular Tags |