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

Quick Search    Search Deep

Source code: com/aendvari/common/util/Debug.java


1   /*
2    * CommonUtil.java
3    *
4    * Copyright (c) 2001, 2002 Aendvari, Ltd. All Rights Reserved.
5    *
6    * See the file LICENSE for terms of use.
7    *
8    */
9   
10  package com.aendvari.common.util;
11  
12  import java.lang.*;
13  
14  
15  /**
16   * <p>Utility class for printing out debug information.</p>
17   *
18   * <p>This class is only meant for on/off of System.out.println().</p>
19   *
20   * @author Scott Milne
21   *
22   */
23  
24  public class Debug
25  {
26    /** Specifies whether to display debug statements. */
27    static private boolean debugEnabled = false;
28  
29    /**
30     * Returns whether debugging is active.
31     *
32     * @return                  True if active, false otherwise.
33     *
34     */
35  
36    public static boolean getDebug()
37    {
38      return debugEnabled;
39    }
40  
41    /**
42     * Sets debugging activation.
43     *
44     * @param    debug            True to turn on, false to turn off.
45     *
46     */
47  
48    public static void setDebug( boolean debug )
49    {
50      debugEnabled = debug;
51    }
52  
53    /**
54     * Prints an object to the output, if debugging is active.
55     *
56     * @param    value            <code>Object</code> to print to output.
57     *
58     */
59  
60    public static void println( Object value )
61    {
62      if( debugEnabled )
63      {
64        System.out.println(value);
65      }
66    }
67  }
68