1 11 package org.eclipse.ui.internal.misc; 12 13 26 public final class Assert { 27 28 private Assert() { 29 } 30 31 40 public static boolean isLegal(boolean expression) { 41 return isLegal(expression, ""); } 43 44 55 public static boolean isLegal(boolean expression, String message) { 56 if (!expression) 57 throw new IllegalArgumentException (); 58 return expression; 59 } 60 61 67 public static void isNotNull(Object object) { 68 isNotNull(object, ""); } 70 71 79 public static void isNotNull(Object object, String message) { 80 if (object == null) 81 throw new AssertionFailedException("null argument;" + message); } 83 84 91 public static boolean isTrue(boolean expression) { 92 return isTrue(expression, ""); } 94 95 104 public static boolean isTrue(boolean expression, String message) { 105 if (!expression) 106 throw new AssertionFailedException("assertion failed; " + message); return expression; 108 } 109 } 110 | Popular Tags |