1 11 package org.eclipse.core.internal.utils; 12 13 import org.eclipse.osgi.util.NLS; 14 15 28 public final class Assert { 29 30 private Assert() { 31 } 33 34 43 public static boolean isLegal(boolean expression) { 44 return isLegal(expression, ""); } 46 47 58 public static boolean isLegal(boolean expression, String message) { 59 if (!expression) 60 throw new IllegalArgumentException (message); 61 return expression; 62 } 63 64 70 public static void isNotNull(Object object) { 71 isNotNull(object, ""); } 73 74 82 public static void isNotNull(Object object, String message) { 83 if (object == null) 84 throw new AssertionFailedException(NLS.bind(Messages.utils_null, message)); 85 } 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(NLS.bind(Messages.utils_failed, message)); 110 return expression; 111 } 112 } 113 | Popular Tags |