Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ltk.internal.core.refactoring
Class Assert  view Assert download Assert.java

java.lang.Object
  extended byorg.eclipse.ltk.internal.core.refactoring.Assert

public final class Assert
extends java.lang.Object

Assert is useful for for embedding runtime sanity checks in code. The predicate methods all test a condition and throw some type of unchecked exception if the condition does not hold.

Assertion failure exceptions, like most runtime exceptions, are thrown when something is misbehaving. Assertion failures are invariably unspecified behavior; consequently, clients should never rely on these being thrown (and certainly should not being catching them specifically).


Constructor Summary
private Assert()
           
 
Method Summary
static boolean isLegal(boolean expression)
          Asserts that an argument is legal.
static boolean isLegal(boolean expression, java.lang.String message)
          Asserts that an argument is legal.
static void isNotNull(java.lang.Object object)
          Asserts that the given object is not null.
static void isNotNull(java.lang.Object object, java.lang.String message)
          Asserts that the given object is not null.
static boolean isTrue(boolean expression)
          Asserts that the given boolean is true.
static boolean isTrue(boolean expression, java.lang.String message)
          Asserts that the given boolean is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assert

private Assert()
Method Detail

isLegal

public static boolean isLegal(boolean expression)
Asserts that an argument is legal. If the given boolean is not true, an IllegalArgumentException is thrown.


isLegal

public static boolean isLegal(boolean expression,
                              java.lang.String message)
Asserts that an argument is legal. If the given boolean is not true, an IllegalArgumentException is thrown. The given message is included in that exception, to aid debugging.


isNotNull

public static void isNotNull(java.lang.Object object)
Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown.


isNotNull

public static void isNotNull(java.lang.Object object,
                             java.lang.String message)
Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.


isTrue

public static boolean isTrue(boolean expression)
Asserts that the given boolean is true. If this is not the case, some kind of unchecked exception is thrown.


isTrue

public static boolean isTrue(boolean expression,
                             java.lang.String message)
Asserts that the given boolean is true. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.