1 11 package org.eclipse.team.internal.ccvs.core.util; 12 13 14 27 public final class Assert { 28 29 private Assert() { 30 } 31 40 public static boolean isLegal(boolean expression) { 41 return isLegal(expression, ""); } 43 54 public static boolean isLegal(boolean expression, String message) { 55 if (!expression) 56 throw new IllegalArgumentException (message); 57 return expression; 58 } 59 65 public static void isNotNull(Object object) { 66 isNotNull(object, ""); } 68 76 public static void isNotNull(Object object, String message) { 77 if (object == null) 78 throw new AssertionFailedException("null argument:" + message); } 80 87 public static boolean isTrue(boolean expression) { 88 return isTrue(expression, ""); } 90 99 public static boolean isTrue(boolean expression, String message) { 100 if (!expression) 101 throw new AssertionFailedException("assertion failed: " + message); return expression; 103 } 104 } 105 | Popular Tags |