Valescom Java API

com.valescom.support.trace.java
Class Trace

java.lang.Object
  |
  +--com.valescom.support.trace.java.Trace

public final class Trace
extends Object

Responsibility:
Providing an access poinbt to print trace output.
Each class that is traced, should have a static Trace object in order to trace.
Behaviour:
Trace propagates trace output to the TraceManager.
Whether a Trace object is active or not is controlled by the TraceManager singleton.
States:
Active, the trace object is active, i.e. client code should not call println()
Not Active, the trace object is not active, i.e. client code can call println()
Usage:

// define class with trace
public class MyClass {   ...   private final static Trace theTrace =   new Trace(MyClass.class.getName()); }
// trace code
public void method(Argument anArgument) {   if (theTrace.ACTIVE) theTrace.println("method(" +   "anArgument = " + anArgument + ")");   ... }

 

Field Summary
 boolean ACTIVE
          Flag to indicate whether the trace object is active or not.
 
Constructor Summary
Trace(String anId)
          This method creates a Trace object given an id, typically a class name.
 
Method Summary
 void println(String aString)
          Prints trace output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVE

public boolean ACTIVE
Flag to indicate whether the trace object is active or not. This member is controlled by the TraceManager.

See Also:
TraceManager
Constructor Detail

Trace

public Trace(String anId)
This method creates a Trace object given an id, typically a class name. After creation the Trace object is registered to the TraceManager.

Pre conditions:
anId must be not null.

Parameters:
anId - Id to trace.
See Also:
TraceManager
Method Detail

println

public final void println(String aString)
Prints trace output.

Pre conditions:
aString must be not null.

Parameters:
aString - String to write as trace output for this Trace object.
See Also:
TraceManager

Valescom Java API

Copyright 1998, 2003 - Valescom