Class Assert

java.lang.Object
  |
  +--Assert

public final class Assert
extends java.lang.Object

A class that acts like the C/C++ assertion macro. For a detailed description of this topic look at http://www.afu.com/javafaq.html and search for "11.6 How can I write C/C++ style assertions in Java?". All assert methods throw an AssertionException, if the asserted condition is not true and the "Enable assertions" checkbox was selected while creating the class from the template.

See Also:
AssertionException

Field Summary
static boolean ENABLED
          True if assert methods are enabled.
 
Method Summary
static void assert(boolean b)
          Assert that the boolean condition b is true.
static void assert(boolean b, java.lang.String s)
          Assert that the boolean condition b is true.
static void assert(long l)
          Assert that the long parameter l is not zero.
static void assert(long l, java.lang.String s)
          Assert that the long parameter l is not zero.
static void assert(java.lang.Object ref)
          Assert that the object reference l is not null.
static void assert(java.lang.Object ref, java.lang.String s)
          Assert that the object reference l is not null.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLED

public static final boolean ENABLED
True if assert methods are enabled.
Method Detail

assert

public static final void assert(boolean b)
Assert that the boolean condition b is true.
Parameters:
b - The boolean condition to check.

assert

public static final void assert(boolean b,
                                java.lang.String s)
Assert that the boolean condition b is true.
Parameters:
b - The boolean condition to check.
s - The detail message for the resulting exception.

assert

public static final void assert(long l)
Assert that the long parameter l is not zero.
Parameters:
l - The long value to check.

assert

public static final void assert(long l,
                                java.lang.String s)
Assert that the long parameter l is not zero.
Parameters:
l - The long value to check.
s - The detail message for the resulting exception.

assert

public static final void assert(java.lang.Object ref)
Assert that the object reference l is not null.
Parameters:
ref - The object reference to check.

assert

public static final void assert(java.lang.Object ref,
                                java.lang.String s)
Assert that the object reference l is not null.
Parameters:
ref - The object reference to check.
s - The detail message for the resulting exception.