|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.mortbay.util.Code
Coding Standards support. Support for defensive programming Coding defensively as follows:
{
...
Code.assert(booleanExpression(),"Assert that expression evaluates true");
...
Code.assertEquals(objectA,objectB,"Assert equality");
Code.assertEquals(1,2,"Assert equality");
...
Code.debug("Debug message");
...
Code.debug("Debug message",exception,object);
...
Code.warning("warning message");
...
Code.warning("warning message",exception);
...
Code.notImplemented();
Code.fail("fatal error");
...
}
The debug output can be controlled with java properties:
java [-DDEBUG [-DDEBUG_PATTERNS="MyClass,my.package"] \\
[-DDEBUG_OPTIONS=[S][W]] \\
[-DDEBUG_VERBOSE=n] ] \\
my.package.main
ISS.Base.Log| Method Summary | |
static void |
assert(boolean b,
java.lang.String m)
Check assertion that a boolean is true. |
static void |
assertContains(java.lang.String string,
java.lang.String sub,
java.lang.String m)
Check assertion that a string is a substring of another. |
static void |
assertEquals(char o1,
char o2,
java.lang.String m)
Check assertion that o1==o2. |
static void |
assertEquals(double o1,
double o2,
java.lang.String m)
Check assertion that o1==o2. |
static void |
assertEquals(long o1,
long o2,
java.lang.String m)
Check assertion that o1==o2. |
static void |
assertEquals(java.lang.Object o1,
java.lang.Object o2,
java.lang.String m)
Check assertion that o1==o2. |
static boolean |
debug()
Get debug status for the current stack frame. |
static void |
debug(int depth,
java.lang.Object o)
Debug with frame depth. |
static void |
debug(java.lang.Object o)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
long i)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
long l1,
java.lang.Object o2,
long l2)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5,
java.lang.Object o6)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5,
java.lang.Object o6,
java.lang.Object o7)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5,
java.lang.Object o6,
java.lang.Object o7,
java.lang.Object o8)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.String m)
Programming debugging output sent to the Log. |
static void |
debug(java.lang.String m,
java.lang.Throwable ex)
As debug(String) Do not rely on side-effects |
static void |
debug(java.lang.Throwable ex)
As debug(String) Dont rely on side-effects |
static void |
fail(java.lang.String m)
Programmer initiated fatal CodeException. |
static void |
fail(java.lang.String m,
java.lang.Throwable ex)
Programmer initiated fatal error. |
static void |
fail(java.lang.Throwable ex)
Programmer initiated fatal error. |
static boolean |
getDebug()
Get the debug status. |
static java.lang.String |
getDebugPatterns()
Get the debug patterns. |
static java.lang.String |
getDebugTriggers()
Get the debug triggers. |
static boolean |
getSuppressStack()
Get the stack suppression status. |
static boolean |
getSuppressWarnings()
Get the warnings suppression status. |
static int |
getVerbose()
Get the verbosity level. |
static void |
ignore(java.lang.Throwable ex)
Ignore an exception. |
static void |
initParamsFromApplet(java.applet.Applet appl)
Initialize default behaviour from applet parameters. |
static Code |
instance()
|
static void |
notImplemented()
Standard fatal error for a method not yet implemented. |
static void |
setDebug(boolean debug)
Set if debugging is on or off. |
static void |
setDebugPatterns(java.lang.String patterns)
Set debug patterns. |
static void |
setDebugTriggers(java.lang.String triggers)
Set debug triggers. |
static void |
setSuppressStack(boolean stack)
Suppress stack trace. |
static void |
setSuppressWarnings(boolean warnings)
Set warning suppression. |
static void |
setVerbose(int verbose)
Set verbosity level. |
static void |
triggerOff(java.lang.String trigger)
|
static void |
triggerOn(java.lang.String trigger)
|
static boolean |
verbose()
Get verbosity level. |
static boolean |
verbose(int v)
Get verbosity level. |
static void |
warning(java.lang.String m)
Programmer initiated warning, intended to be viewed by technical not operational staff. |
static void |
warning(java.lang.String m,
java.lang.Throwable ex)
Programmer initiated warning, intended to be viewed by technical not operational staff. |
static void |
warning(java.lang.Throwable ex)
Programmer initiated warning, intended to be viewed by technical not operational staff. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Code instance()
public static void initParamsFromApplet(java.applet.Applet appl)
public static void setDebug(boolean debug)
debug - public static boolean getDebug()
public static void setSuppressStack(boolean stack)
stack - if true stacks are not producedpublic static boolean getSuppressStack()
public static void setSuppressWarnings(boolean warnings)
warnings - Warnings suppress if this is true and debug is falsepublic static boolean getSuppressWarnings()
public static void setVerbose(int verbose)
verbose - public static int getVerbose()
public static void setDebugPatterns(java.lang.String patterns)
patterns - coma separated string of patternspublic static java.lang.String getDebugPatterns()
public static void setDebugTriggers(java.lang.String triggers)
triggers - comma separated string of triggerspublic static java.lang.String getDebugTriggers()
public static void triggerOn(java.lang.String trigger)
public static void triggerOff(java.lang.String trigger)
public static void assert(boolean b,
java.lang.String m)
b - The boolean to assert is truem - Message to log if assertion failsCodeException - Thrown if assertion fails
public static void assertEquals(java.lang.Object o1,
java.lang.Object o2,
java.lang.String m)
o1 - The first object to checko2 - The first object to checkm - Message to log if assertion failsCodeException - Thrown if assertion fails
public static void assertEquals(long o1,
long o2,
java.lang.String m)
o1 - The first long to checko2 - The first long to checkm - Message to log if assertion failsCodeException - Thrown if assertion fails
public static void assertEquals(double o1,
double o2,
java.lang.String m)
o1 - The first double to checko2 - The first double to checkm - Message to log if assertion failsCodeException - Thrown if assertion fails
public static void assertEquals(char o1,
char o2,
java.lang.String m)
o1 - The first char to checko2 - The first char to checkm - Message to log if assertion failsCodeException - Thrown if assertion fails
public static void assertContains(java.lang.String string,
java.lang.String sub,
java.lang.String m)
string - The stringsub - The sub stringm - Message to log if assertion failsCodeException - Thrown if assertion failspublic static void warning(java.lang.String m)
m - The message body of the warning
public static void warning(java.lang.String m,
java.lang.Throwable ex)
m - The message body of the warningex - A Throwable objectpublic static void warning(java.lang.Throwable ex)
ex - A Throwable objectpublic static void fail(java.lang.String m)
m - The message body to log with the fatal errorCodeException - thrown to cause fatal error
public static void fail(java.lang.String m,
java.lang.Throwable ex)
m - The message body to log with the fatal errorex - The Throwable to print the full stack trace ofCodeException - thrown to cause fatal errorpublic static void fail(java.lang.Throwable ex)
ex - The Throwable to print the full stack trace ofCodeException - thrown to cause fatal errorpublic static void notImplemented()
public static boolean verbose()
public static boolean verbose(int v)
v - verbosity level to check againstpublic static boolean debug()
public static void debug(java.lang.String m)
m - The debug message to log.
public static void debug(java.lang.String m,
java.lang.Throwable ex)
m - The debug message to log.ex - The Throwable to print the full stack trace ofpublic static void debug(java.lang.Throwable ex)
ex - The Throwable to print the full stack trace of
public static void debug(int depth,
java.lang.Object o)
depth - Depth of debug frame, 1=caller, 2=callers caller...o - Objectpublic static void debug(java.lang.Object o)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
long i)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
long l1,
java.lang.Object o2,
long l2)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5,
java.lang.Object o6)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5,
java.lang.Object o6,
java.lang.Object o7)
ex - The Throwable to print the full stack trace of
public static void debug(java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4,
java.lang.Object o5,
java.lang.Object o6,
java.lang.Object o7,
java.lang.Object o8)
ex - The Throwable to print the full stack trace ofpublic static void ignore(java.lang.Throwable ex)
ex - The Throwable to print the full stack trace of
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||