1 8 9 package com.sleepycat.je; 10 11 14 class DatabaseUtil { 15 16 19 static void checkForNullParam(Object param, String name) { 20 if (param == null) { 21 throw new NullPointerException (name + " cannot be null"); 22 } 23 } 24 25 28 static void checkForNullDbt(DatabaseEntry dbt, 29 String name, 30 boolean checkData) { 31 if (dbt == null) { 32 throw new NullPointerException 33 ("DatabaseEntry " + name + " cannot be null"); 34 } 35 36 if (checkData) { 37 if (dbt.getData() == null) { 38 throw new NullPointerException 39 ("Data field for DatabaseEntry " + 40 name + " cannot be null"); 41 } 42 } 43 } 44 45 49 static void checkForPartialKey(DatabaseEntry dbt) { 50 if (dbt.getPartial()) { 51 throw new IllegalArgumentException 52 ("A partial key DatabaseEntry is not allowed"); 53 } 54 } 55 } 56 | Popular Tags |