|
Extension SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.ide.util.Assert
The Assert
class provides basic assertion and tracing support.
All of the methods in this class are static and return void; this allows
the OJC compiler to optionally exclude calls to these methods made from
other classes. Thus, Assert
method calls can be present in
debug builds and not in release builds.
The check
and precondition
methods will
throw exceptions if checking is enabled. Checking is enabled
by default. To disable checking, pass the flag
-Dide.AssertCheckingDisabled=trueto the VM when starting up by using an AddVMOption entry in the jdev.conf file or passing the flag on the command line if invoking directly.
precondition(boolean, java.lang.String)
,
check(boolean, java.lang.String)
Method Summary | |
static void |
check(boolean condition)
Check a condition within a method body. |
static void |
check(boolean condition,
java.lang.String description)
Check a condition within a method body. |
static void |
checkAWTThread()
Checks that the current thread is the AWT event dispatcher. |
static void |
exit(int code)
Exit the IDE with an error code. |
static void |
fail()
Shorthand for causing a check exception if the code reaches an unexpected location. |
static void |
fail(java.lang.Exception ex)
Shorthand for causing a check exception if the code reaches an unexpected location. |
static void |
fail(java.lang.String description)
Shorthand for causing a check exception if the code reaches an unexpected location. |
static void |
precondition(boolean condition)
Assert a precondition before a method body run. |
static void |
precondition(boolean condition,
java.lang.String description)
Assert a precondition before a method body run. |
static void |
print(boolean condition,
java.lang.String s)
Print a string to standard error if a condition is true. |
static void |
print(boolean condition,
java.lang.String trueString,
java.lang.String falseString)
Print a string to standard error based on the evaluation of a condition. |
static void |
print(java.lang.String s)
Print a string to standard error. |
static void |
println(boolean condition,
java.lang.String s)
Print a string and a newline to standard error if a condition is true |
static void |
println(boolean condition,
java.lang.String trueString,
java.lang.String falseString)
Print a string and a newline to standard error based on the evaluation of a condition. |
static void |
println(java.lang.String s)
Print a string and a newline to standard error. |
static void |
printStackTrace()
Print a diagnostic stack trace of the current thread. |
static void |
printStackTrace(boolean condition,
java.lang.String s)
Print a diagnostic stack trace if the specified condition is true. |
static void |
printStackTrace(java.lang.Throwable ex)
Print the stack trace of a Throwable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void precondition(boolean condition, java.lang.String description) throws oracle.ide.util.Assert.PreconditionException
condition
- The condition being asserted.description
- The description of the failed assertionpublic static void precondition(boolean condition) throws oracle.ide.util.Assert.PreconditionException
condition
- The condition being asserted.public static void check(boolean condition, java.lang.String description) throws oracle.ide.util.Assert.CheckException
condition
- The condition being asserted.description
- The description of the failed assertionpublic static void check(boolean condition) throws oracle.ide.util.Assert.CheckException
condition
- The condition being asserted.public static void checkAWTThread() throws oracle.ide.util.Assert.CheckException
public static void fail(java.lang.String description) throws oracle.ide.util.Assert.CheckException
description
- The description of the failurepublic static void fail() throws oracle.ide.util.Assert.CheckException
public static void fail(java.lang.Exception ex) throws oracle.ide.util.Assert.CheckException
ex
- An exception encapsulating the failurepublic static void exit(int code)
code
- the Exit code.public static void printStackTrace()
public static void printStackTrace(java.lang.Throwable ex)
ex
- The Throwable with the stack trace info.public static void printStackTrace(boolean condition, java.lang.String s)
condition
- the condition that determines whether to print the
stack trace.s
- the string to print before the stack trace.public static void print(java.lang.String s)
s
- the string to print.public static void print(boolean condition, java.lang.String s)
condition
- the condition to evaluates
- the string to print.public static void print(boolean condition, java.lang.String trueString, java.lang.String falseString)
condition
- the condition to evaluatetrueString
- the string to print if condition
is
true.falseString
- the string to print if condition
is
false.public static void println(java.lang.String s)
s
- the string to printpublic static void println(boolean condition, java.lang.String s)
condition
- the condition to evaluates
- the string to print.public static void println(boolean condition, java.lang.String trueString, java.lang.String falseString)
condition
- the condition to evaluatetrueString
- the string to print if condition
is
true.falseString
- the string to print if condition
is
false.
|
Extension SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |