javax.slee.facilities
Class TraceLevel

java.lang.Object
  extended by javax.slee.facilities.TraceLevel
All Implemented Interfaces:
java.io.Serializable

public final class TraceLevel
extends java.lang.Object
implements java.io.Serializable

This class defines an enumerated type for the trace levels supported by the Trace Facility. The class is based on the Java Logging API included with J2SE 1.4.

A singleton instance of each enumerated value is guaranteed (via an implementation of readResolve() - refer java.io.Serializable), so that equality tests using == are always evaluated correctly. (This equality test is only guaranteed if this class is loaded in the application's boot class path, rather than dynamically loaded at runtime.)

The trace levels in descending order are:

The trace level OFF is also defined for the purposes of disabling trace message generation at the management level.

Since:
SLEE 1.1
See Also:
Serialized Form

Field Summary
static TraceLevel CONFIG
          Trace level for messages relating to configuration.
static java.lang.String CONFIG_STRING
          A string representation of CONFIG.
static TraceLevel FINE
          Trace level for general coarse-grained debugging messages.
static java.lang.String FINE_STRING
          A string representation of FINE.
static TraceLevel FINER
          Trace level for debug messages containing moderate detail.
static java.lang.String FINER_STRING
          A string representation of FINER.
static TraceLevel FINEST
          Trace level for highly detailed or fine-grained messages.
static java.lang.String FINEST_STRING
          A string representation of FINEST.
static TraceLevel INFO
          Trace level for general information messages.
static java.lang.String INFO_STRING
          A string representation of INFO.
static int LEVEL_CONFIG
          An integer representation of CONFIG.
static int LEVEL_FINE
          An integer representation of FINE.
static int LEVEL_FINER
          An integer representation of FINER.
static int LEVEL_FINEST
          An integer representation of FINEST.
static int LEVEL_INFO
          An integer representation of INFO.
static int LEVEL_OFF
          An integer representation of OFF.
static int LEVEL_SEVERE
          An integer representation of SEVERE.
static int LEVEL_WARNING
          An integer representation of WARNING.
static TraceLevel OFF
          Trace level for maximum filtering.
static java.lang.String OFF_STRING
          A string representation of OFF.
static TraceLevel SEVERE
          Trace level for messages that indicate a severe error has occurred.
static java.lang.String SEVERE_STRING
          A string representation of SEVERE.
static TraceLevel WARNING
          Trace level for messages that indicate warnings.
static java.lang.String WARNING_STRING
          A string representation of WARNING.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this trace level for equality with another.
static TraceLevel fromInt(int level)
          Get a TraceLevel object from an integer value.
static TraceLevel fromString(java.lang.String level)
          Get a TraceLevel object from a string value.
 int hashCode()
          Get a hash code value for this trace level.
 boolean isConfig()
          Determine if this TraceLevel object represents the CONFIG level.
 boolean isFine()
          Determine if this TraceLevel object represents the FINE level.
 boolean isFiner()
          Determine if this TraceLevel object represents the FINER level.
 boolean isFinest()
          Determine if this TraceLevel object represents the FINEST level.
 boolean isHigherLevel(TraceLevel other)
          Determine if this TraceLevel object represents a level that is higher than some other TraceLevel object.
 boolean isInfo()
          Determine if this TraceLevel object represents the INFO level.
 boolean isOff()
          Determine if this TraceLevel object represents the OFF level.
 boolean isSevere()
          Determine if this TraceLevel object represents the SEVERE level.
 boolean isWarning()
          Determine if this TraceLevel object represents the WARNING level.
 int toInt()
          Get an integer value representation for this TraceLevel object.
 java.lang.String toString()
          Get the textual representation of the TraceLevel object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LEVEL_OFF

public static final int LEVEL_OFF
An integer representation of OFF.

See Also:
Constant Field Values

LEVEL_SEVERE

public static final int LEVEL_SEVERE
An integer representation of SEVERE.

See Also:
Constant Field Values

LEVEL_WARNING

public static final int LEVEL_WARNING
An integer representation of WARNING.

See Also:
Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
An integer representation of INFO.

See Also:
Constant Field Values

LEVEL_CONFIG

public static final int LEVEL_CONFIG
An integer representation of CONFIG.

See Also:
Constant Field Values

LEVEL_FINE

public static final int LEVEL_FINE
An integer representation of FINE.

See Also:
Constant Field Values

LEVEL_FINER

public static final int LEVEL_FINER
An integer representation of FINER.

See Also:
Constant Field Values

LEVEL_FINEST

public static final int LEVEL_FINEST
An integer representation of FINEST.

See Also:
Constant Field Values

OFF_STRING

public static final java.lang.String OFF_STRING
A string representation of OFF.

See Also:
Constant Field Values

SEVERE_STRING

public static final java.lang.String SEVERE_STRING
A string representation of SEVERE.

See Also:
Constant Field Values

WARNING_STRING

public static final java.lang.String WARNING_STRING
A string representation of WARNING.

See Also:
Constant Field Values

INFO_STRING

public static final java.lang.String INFO_STRING
A string representation of INFO.

See Also:
Constant Field Values

CONFIG_STRING

public static final java.lang.String CONFIG_STRING
A string representation of CONFIG.

See Also:
Constant Field Values

FINE_STRING

public static final java.lang.String FINE_STRING
A string representation of FINE.

See Also:
Constant Field Values

FINER_STRING

public static final java.lang.String FINER_STRING
A string representation of FINER.

See Also:
Constant Field Values

FINEST_STRING

public static final java.lang.String FINEST_STRING
A string representation of FINEST.

See Also:
Constant Field Values

OFF

public static final TraceLevel OFF
Trace level for maximum filtering. Notifications are not be generated using this level.


SEVERE

public static final TraceLevel SEVERE
Trace level for messages that indicate a severe error has occurred.


WARNING

public static final TraceLevel WARNING
Trace level for messages that indicate warnings.


INFO

public static final TraceLevel INFO
Trace level for general information messages.


CONFIG

public static final TraceLevel CONFIG
Trace level for messages relating to configuration.


FINE

public static final TraceLevel FINE
Trace level for general coarse-grained debugging messages.


FINER

public static final TraceLevel FINER
Trace level for debug messages containing moderate detail.


FINEST

public static final TraceLevel FINEST
Trace level for highly detailed or fine-grained messages. This is the lowest trace level.

Method Detail

fromInt

public static TraceLevel fromInt(int level)
                          throws java.lang.IllegalArgumentException
Get a TraceLevel object from an integer value.

Parameters:
level - the level as an integer.
Returns:
a TraceLevel object corresponding to level.
Throws:
java.lang.IllegalArgumentException - if level is not a valid trace level value.

fromString

public static TraceLevel fromString(java.lang.String level)
                             throws java.lang.NullPointerException,
                                    java.lang.IllegalArgumentException
Get a TraceLevel object from a string value.

Parameters:
level - the level as a string, for example as returned by the toString() method (case insensitive).
Returns:
a TraceLevel object corresponding to level.
Throws:
java.lang.NullPointerException - if level is null.
java.lang.IllegalArgumentException - if level is not a valid trace level string.

toInt

public int toInt()
Get an integer value representation for this TraceLevel object.

Returns:
an integer value representation for this TraceLevel object.

isOff

public boolean isOff()
Determine if this TraceLevel object represents the OFF level.

This method is effectively equivalent to the conditional test: (this == OFF), ie. the code:

    if (traceLevel.isOff()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.OFF) ...

Returns:
true if this object represents the OFF level, false otherwise.

isSevere

public boolean isSevere()
Determine if this TraceLevel object represents the SEVERE level.

This method is effectively equivalent to the conditional test: (this == SEVERE), ie. the code:

    if (traceLevel.isSevere()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.SEVERE) ...

Returns:
true if this object represents the SEVERE level, false otherwise.

isWarning

public boolean isWarning()
Determine if this TraceLevel object represents the WARNING level.

This method is effectively equivalent to the conditional test: (this == WARNING), ie. the code:

    if (traceLevel.isWarning()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.WARNING) ...

Returns:
true if this object represents the WARNING level, false otherwise.

isInfo

public boolean isInfo()
Determine if this TraceLevel object represents the INFO level.

This method is effectively equivalent to the conditional test: (this == INFO), ie. the code:

    if (traceLevel.isMinor()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.INFO) ...

Returns:
true if this object represents the INFO level, false otherwise.

isConfig

public boolean isConfig()
Determine if this TraceLevel object represents the CONFIG level.

This method is effectively equivalent to the conditional test: (this == CONFIG), ie. the code:

    if (traceLevel.isConfig()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.CONFIG) ...

Returns:
true if this object represents the CONFIG level, false otherwise.

isFine

public boolean isFine()
Determine if this TraceLevel object represents the FINE level.

This method is effectively equivalent to the conditional test: (this == FINE), ie. the code:

    if (traceLevel.isFine()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.FINE) ...

Returns:
true if this object represents the FINE level, false otherwise.

isFiner

public boolean isFiner()
Determine if this TraceLevel object represents the FINER level.

This method is effectively equivalent to the conditional test: (this == FINER), ie. the code:

    if (traceLevel.isFiner()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.FINER) ...

Returns:
true if this object represents the FINER level, false otherwise.

isFinest

public boolean isFinest()
Determine if this TraceLevel object represents the FINEST level.

This method is effectively equivalent to the conditional test: (this == FINEST), ie. the code:

    if (traceLevel.isFinest()) ...

is interchangeable with the code:

   if (traceLevel == TraceLevel.FINEST) ...

Returns:
true if this object represents the FINEST level, false otherwise.

isHigherLevel

public boolean isHigherLevel(TraceLevel other)
                      throws java.lang.NullPointerException
Determine if this TraceLevel object represents a level that is higher than some other TraceLevel object. For the purposes of the comparison OFF is considered a higher level than SEVERE, and FINEST is the lowest level.

Parameters:
other - the TraceLevel object to compare this with.
Returns:
true if the level represented by this TraceLevel object is a higher level than the level represented by the specified TraceLevel object, false otherwise.
Throws:
java.lang.NullPointerException - if other is null.

equals

public boolean equals(java.lang.Object obj)
Compare this trace level for equality with another.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is an instance of this class representing the same level as this, false otherwise.

hashCode

public int hashCode()
Get a hash code value for this trace level.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value.

toString

public java.lang.String toString()
Get the textual representation of the TraceLevel object.

Overrides:
toString in class java.lang.Object
Returns:
the textual representation of the TraceLevel object.


Copyright © 2008. All Rights Reserved.