|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.stp.core.infrastructure.assertion.Assert
public final class Assert
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).
Reused from the internal version in Platform.
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 |
isNotImplementedYet(java.lang.String message)
Asserts that a call to an operation that is not implemented yet. |
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 void |
isNotNullOrEmtpy(java.lang.String string,
java.lang.String message)
Asserts that the given string is not null and it has a length greater than zero. |
static void |
isNotSupported(java.lang.String message)
Asserts that a call to an operation is not supported. |
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean isLegal(boolean expression)
true
, an IllegalArgumentException
is
thrown.
expression
- the outcode of the check
true
if the check passes (does not return if the
check fails)
java.lang.IllegalArgumentException
- if the legality test failedpublic static boolean isLegal(boolean expression, java.lang.String message)
true
, an IllegalArgumentException
is
thrown. The given message is included in that exception, to aid debugging.
expression
- the outcode of the checkmessage
- the message to include in the exception
true
if the check passes (does not return if the
check fails)
java.lang.IllegalArgumentException
- if the legality test failedpublic static void isNotNull(java.lang.Object object)
null
. If this is not
the case, some kind of unchecked exception is thrown.
object
- the value to test
java.lang.IllegalArgumentException
- if the object is null
public static void isNotNull(java.lang.Object object, java.lang.String message)
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.
object
- the value to testmessage
- the message to include in the exception
java.lang.IllegalArgumentException
- if the object is null
public static boolean isTrue(boolean expression)
true
. If this is not the
case, some kind of unchecked exception is thrown.
expression
- the outcode of the check
true
if the check passes (does not return if the
check fails)public static boolean isTrue(boolean expression, java.lang.String message)
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.
expression
- the outcode of the checkmessage
- the message to include in the exception
true
if the check passes (does not return if the
check fails)public static void isNotNullOrEmtpy(java.lang.String string, java.lang.String message)
string
- message
- public static void isNotSupported(java.lang.String message)
message
- public static void isNotImplementedYet(java.lang.String message)
message
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |