1 11 package org.eclipse.core.internal.runtime; 12 13 26 public final class Assert { 27 28 private Assert() { 29 } 31 32 41 public static boolean isLegal(boolean expression) { 42 return isLegal(expression, ""); } 44 45 56 public static boolean isLegal(boolean expression, String message) { 57 if (!expression) 58 throw new IllegalArgumentException (message); 59 return expression; 60 } 61 62 68 public static void isNotNull(Object object) { 69 isNotNull(object, ""); } 71 72 80 public static void isNotNull(Object object, String message) { 81 if (object == null) 82 throw new AssertionFailedException("null argument:" + message); } 84 85 92 public static boolean isTrue(boolean expression) { 93 return isTrue(expression, ""); } 95 96 105 public static boolean isTrue(boolean expression, String message) { 106 if (!expression) 107 throw new AssertionFailedException("assertion failed: " + message); return expression; 109 } 110 } 111 | Popular Tags |