1 11 package org.eclipse.core.internal.expressions; 12 13 26 public final class Assert { 27 28 29 private Assert() { 30 } 32 41 public static boolean isLegal(boolean expression) { 42 return isLegal(expression, ""); } 44 55 public static boolean isLegal(boolean expression, String message) { 56 if (!expression) 57 throw new IllegalArgumentException (message); 58 return expression; 59 } 60 66 public static void isNotNull(Object object) { 67 isNotNull(object, ""); } 69 77 public static void isNotNull(Object object, String message) { 78 if (object == null) 79 throw new AssertionFailedException("null argument:" + message); } 81 88 public static boolean isTrue(boolean expression) { 89 return isTrue(expression, ""); } 91 100 public static boolean isTrue(boolean expression, String message) { 101 if (!expression) 102 throw new AssertionFailedException("assertion failed: " + message); return expression; 104 } 105 } 106 | Popular Tags |