1 11 package org.eclipse.core.runtime; 12 13 30 public final class Assert { 31 32 private Assert() { 33 } 35 36 45 public static boolean isLegal(boolean expression) { 46 return isLegal(expression, ""); } 48 49 60 public static boolean isLegal(boolean expression, String message) { 61 if (!expression) 62 throw new IllegalArgumentException (message); 63 return expression; 64 } 65 66 71 public static void isNotNull(Object object) { 72 isNotNull(object, ""); } 74 75 82 public static void isNotNull(Object object, String message) { 83 if (object == null) 84 throw new AssertionFailedException("null argument:" + message); } 86 87 94 public static boolean isTrue(boolean expression) { 95 return isTrue(expression, ""); } 97 98 107 public static boolean isTrue(boolean expression, String message) { 108 if (!expression) 109 throw new AssertionFailedException("assertion failed: " + message); return expression; 111 } 112 } 113 | Popular Tags |