Class Trace

java.lang.Object
com.adobe.xfa.ut.trace.Trace

public final class Trace extends Object
This auto registering class is used to define trace areas and issue messages. The implementer defines an instances of the jfTrace class in the file scope to ensure all trace areas are available before run-time. These instances then are registered with the jfTraceHandler during its construction
  
  example:
 
                Trace oDataTrace = new Trace("data", ResId.DataTraceHelp);
                Trace oStringTrace new Trace("string" ResId.StringTraceHelp);
                main(...)
                {
                        TraceHandler oTraceHandler = new TraceHandler();
 
                        TraceHandler.registerTraceHandler(oTraceHandler);
 
                        // two ways to activate 
                        oTraceHandler.activate("data", 2);
                        oStringTrace.activate(3);
 
                        ...
                        oTraceHandler.trace(oDataTrace, 2, 27, "data msg"); // issue message
                        ...
                        oDataTrace.trace(2, 33, "string msg"); // issue message
                        ...
                }
 
  
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Trace(String sName, int nHelpId)
    Constructor Registers the trace with a global storage area.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(int nLevel)
    Activates this trace section for the current thread
    void
    Deactivates this trace section for the current thread
    int
     
    Returns the name of this trace section
    boolean
    isEnabled(int nLevel)
    Check if this trace section is enabled on the current thread.
    static boolean
    isEnabled(String sName, int nLevel)
    Check if this trace section is enabled on the current thread
    void
    trace(int nLevel, int nId, String sMsg)
    Issues a trace message.
    void
    trace(int nLevel, MsgFormatPos oMsg)
    Issues a trace message.
    static void
    trace(String sName, int nLevel, int nId, String sMsg)
    Issues a trace message on the current thread.
    static void
    trace(String sName, int nLevel, MsgFormatPos oMsg)
    Issues a trace message.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Trace

      public Trace(String sName, int nHelpId)
      Constructor Registers the trace with a global storage area.
      Parameters:
      sName - the name of the trace section for which the message will be issued
      nHelpId - the message Id associated with a one-line help message for this trace section.
  • Method Details

    • isEnabled

      public static boolean isEnabled(String sName, int nLevel)
      Check if this trace section is enabled on the current thread
      Parameters:
      sName - - the name of the trace section for which the message will be issued
      nLevel - - the detail level of the messages allowed,
      Returns:
      true if this trace section is enabled on the current thread, else false
    • trace

      public static void trace(String sName, int nLevel, int nId, String sMsg)
      Issues a trace message on the current thread.
      Parameters:
      sName - the name of the trace section for which the message will be issued
      nLevel - the detail level of the message, 1 for high level information, 3 for detailed information.
      nId - the message Id.
      sMsg - the message text.
    • trace

      public static void trace(String sName, int nLevel, MsgFormatPos oMsg)
      Issues a trace message.
      Parameters:
      sName - the name of the trace section for which the message will be issued
      nLevel - the detail level of the message, 1 for high level information, 3 for detailed information.
      oMsg - the message for the trace.
    • activate

      public void activate(int nLevel)
      Activates this trace section for the current thread
      Parameters:
      nLevel - the detail level of the messages allowed, 1 for high level information, 3 for detailed information.
    • deactivate

      public void deactivate()
      Deactivates this trace section for the current thread
    • getHelpId

      public int getHelpId()
    • getName

      public String getName()
      Returns the name of this trace section
      Returns:
      the name of this trace section
    • isEnabled

      public boolean isEnabled(int nLevel)
      Check if this trace section is enabled on the current thread.
      Parameters:
      nLevel - the detail level of the messages allowed,
      Returns:
      true if this trace section is enabled on the current thread, else false
    • trace

      public void trace(int nLevel, int nId, String sMsg)
      Issues a trace message.
      Parameters:
      nLevel - the detail level of the message, 1 for high level information, 3 for detailed information.
      nId - the message Id.
      sMsg - the message text.
    • trace

      public void trace(int nLevel, MsgFormatPos oMsg)
      Issues a trace message.
      Parameters:
      nLevel - the detail level of the message, 1 for high level information, 3 for detailed information.
      oMsg - the message for the trace.