Class Debug

java.lang.Object
ucar.unidata.util.Debug

public class Debug extends Object
This is a simple way to add runtime-settable debugging. Debug flags are just strings; the Debug class dynamically adds them to the debug menu. Example: putting a runtime flag in your code. A convention I use is to put the name of the debug flag in the message, so I know "where it comes from".
   if (Debug.isSet("Map.draw")) {
     System.out.println("Map.draw: makeShapes with "+displayProject);
   }
   
Example: adding the debug menu to a "System" menu
   private JMenu debugMenu;

   JMenu sysMenu = new JMenu("System");
   debugMenu = (JMenu) sysMenu.add(new JMenu("Debug"));
   debugMenu.addMenuListener( new MenuListener() {
     public void menuSelected(MenuEvent e) { ucar.unidata.util.Debug.constructMenu(debugMenu); }
     public void menuDeselected(MenuEvent e) {}
     public void menuCanceled(MenuEvent e) {}
   });
   
  • Constructor Details

    • Debug

      public Debug()
  • Method Details

    • fetchPersistentData

      public static void fetchPersistentData(PersistentStore store)
      call this when you want to fetch the persistent data
      Parameters:
      store -
    • storePersistentData

      public static void storePersistentData(PersistentStore store)
      call this when you want to store the persistent data
      Parameters:
      store -
    • isSet

      public static boolean isSet(String flagName)
      _more_
      Parameters:
      flagName -
      Returns:
      _more_
    • set

      public static void set(String flagName, boolean value)
      _more_
      Parameters:
      flagName -
      value -
    • clear

      public static void clear()
      _more_
    • constructMenu

      public static void constructMenu(JMenu topMenu)
      _more_
      Parameters:
      topMenu -