Mercurial > projects > dwt-addons
comparison dwtx/jface/text/Assert.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | 000f9136b8f7 |
children |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
171 * </p> | 171 * </p> |
172 * <p> | 172 * <p> |
173 * Note that an <code>assert</code> statement is slated to be added to the | 173 * Note that an <code>assert</code> statement is slated to be added to the |
174 * Java language in JDK 1.4, rending this class obsolete. | 174 * Java language in JDK 1.4, rending this class obsolete. |
175 * </p> | 175 * </p> |
176 * | 176 * |
177 * @deprecated As of 3.3, replaced by {@link dwtx.core.runtime.Assert} | 177 * @deprecated As of 3.3, replaced by {@link dwtx.core.runtime.Assert} |
178 * @noinstantiate This class is not intended to be instantiated by clients. | 178 * @noinstantiate This class is not intended to be instantiated by clients. |
179 */ | 179 */ |
180 public final class Assert { | 180 public final class Assert { |
181 | 181 |
252 * if the check fails) | 252 * if the check fails) |
253 * @exception IllegalArgumentException if the legality test failed | 253 * @exception IllegalArgumentException if the legality test failed |
254 */ | 254 */ |
255 public static bool isLegal(bool expression, String message) { | 255 public static bool isLegal(bool expression, String message) { |
256 if (!expression) | 256 if (!expression) |
257 throw new IllegalArgumentException("assertion failed; " + message); //$NON-NLS-1$ | 257 throw new IllegalArgumentException("assertion failed; " ~ message); //$NON-NLS-1$ |
258 return expression; | 258 return expression; |
259 } | 259 } |
260 | 260 |
261 /** | 261 /** |
262 * Asserts that the given object is not <code>null</code>. If this | 262 * Asserts that the given object is not <code>null</code>. If this |
302 * @exception RuntimeException an unspecified unchecked exception if the object | 302 * @exception RuntimeException an unspecified unchecked exception if the object |
303 * is <code>null</code> | 303 * is <code>null</code> |
304 */ | 304 */ |
305 public static void isNotNull(Object object, String message) { | 305 public static void isNotNull(Object object, String message) { |
306 if (object is null) | 306 if (object is null) |
307 throw new AssertionFailedException("null argument;" + message);//$NON-NLS-1$ | 307 throw new AssertionFailedException("null argument;" ~ message);//$NON-NLS-1$ |
308 } | 308 } |
309 | 309 |
310 /** | 310 /** |
311 * Asserts that the given bool is <code>true</code>. If this | 311 * Asserts that the given bool is <code>true</code>. If this |
312 * is not the case, some kind of unchecked exception is thrown. | 312 * is not the case, some kind of unchecked exception is thrown. |
333 * @return <code>true</code> if the check passes (does not return | 333 * @return <code>true</code> if the check passes (does not return |
334 * if the check fails) | 334 * if the check fails) |
335 */ | 335 */ |
336 public static bool isTrue(bool expression, String message) { | 336 public static bool isTrue(bool expression, String message) { |
337 if (!expression) | 337 if (!expression) |
338 throw new AssertionFailedException("Assertion failed: "+message);//$NON-NLS-1$ | 338 throw new AssertionFailedException("Assertion failed: "~message);//$NON-NLS-1$ |
339 return expression; | 339 return expression; |
340 } | 340 } |
341 } | 341 } |