DESY ACOP Beans Home

com.cosylab.util
Class Debug

java.lang.Object
  extended by com.cosylab.util.Debug

public final class Debug
extends java.lang.Object

This class generalizes the debug output by providing additional functionality to the System.out.println output, such as enabling, disabling debug or indenting the output.
All methods and fields are declared as static to simplify use.
Indentation can be used to perform stack traces of the methods order of execution.
This class is intended to duplicate the C/C++ macro IFDEF functionality. All debug routines will only be included in the compiled classes if debugging is enabled via the ENABLE_DEBUG flag. If this flag is enabled, most compilers, though not neccessary all, will simply ignore any references to the Debug class. ENABLE_DEBUG flag cannot be changed during runtime.

Version:
$id$
Author:
Ales Pucelj

Field Summary
static boolean ENABLE_DEBUG
           
 
Constructor Summary
Debug()
           
 
Method Summary
static void end(java.lang.String s)
          Creates indented debug output.
static void main(java.lang.String[] args)
          Run test applet.
static void out(java.lang.Object source, java.lang.String s)
          Outputs the debug string and class name if debug output is enabled.
static void out(java.lang.String s)
          Outputs the debug string if debug output is enabled.
static void out(java.lang.Throwable throwable)
          Outputs the exception message if debug output is enabled.
static void start(java.lang.String s)
          Creates indented debug output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLE_DEBUG

public static final boolean ENABLE_DEBUG
See Also:
Constant Field Values
Constructor Detail

Debug

public Debug()
Method Detail

out

public static final void out(java.lang.String s)
Outputs the debug string if debug output is enabled.

Parameters:
s - String to output.

out

public static final void out(java.lang.Throwable throwable)
Outputs the exception message if debug output is enabled.

Parameters:
throwable - Exception to display.

out

public static final void out(java.lang.Object source,
                             java.lang.String s)
Outputs the debug string and class name if debug output is enabled. Output format will be in the form of "source.getClass().getName()": "s"

Parameters:
source - Instance of object that generated this output.
s - String to output.

start

public static final void start(java.lang.String s)
Creates indented debug output. Each call to start() method will increase the indentation by predefined ammount and each call to the end method will decrease it.

Parameters:
s - String to output.

end

public static final void end(java.lang.String s)
Creates indented debug output. Each call to start() method will increase the indentation by predefined ammount and each call to the end method will decrease it.

Parameters:
s - String to output.

main

public static void main(java.lang.String[] args)
Run test applet.

Parameters:
args - command line parameters


Copyright © 2010. All Rights Reserved.