org.objectweb.util.monolog.wrapper.common
Class LevelImpl

java.lang.Object
  extended byorg.objectweb.util.monolog.wrapper.common.LevelImpl
All Implemented Interfaces:
Level, java.io.Serializable
Direct Known Subclasses:
LevelImpl, LevelImpl, LevelImpl

public class LevelImpl
extends java.lang.Object
implements Level, java.io.Serializable

This class is the basic implementation of the Level interface. It proviedes also a static method 'evaluate' which permits to obtain the integer value of a level expression.

Author:
Sebastien Chassande-Barrioz
See Also:
Serialized Form

Constructor Summary
LevelImpl(java.lang.String n, int val)
           
LevelImpl(java.lang.String n, java.lang.String val, LevelFactory lf)
           
 
Method Summary
 int compareTo(Level o)
          Compares this object with the specified object for order.
static int evaluate(java.lang.String expr, LevelFactory lf)
          It analyzes a string expression to obtain its integer value.
 int getIntValue()
          Returns the integer value which represents the level.
 java.lang.String getName()
          It retrieves the name of the Level
 java.lang.String getStringValue()
          It retrieves the string expression of the level.
 int hashCode()
          It retrieves the integer value of the level.
 boolean isComparableWith(Level o)
          This method returns true is the current level and the Level parameter are ordered.
 void setName(java.lang.String n)
          It assigns the name of the Level
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LevelImpl

public LevelImpl(java.lang.String n,
                 int val)

LevelImpl

public LevelImpl(java.lang.String n,
                 java.lang.String val,
                 LevelFactory lf)
Method Detail

hashCode

public int hashCode()
It retrieves the integer value of the level.


getStringValue

public java.lang.String getStringValue()
It retrieves the string expression of the level. ex: 'DEBUG + 1'


evaluate

public static int evaluate(java.lang.String expr,
                           LevelFactory lf)
It analyzes a string expression to obtain its integer value. The allowed expression type are the following:

Parameters:
expr - is the string expression which must be evaluated.
Returns:
an integer value or 0 if it is impossible to evaluate the expression.

toString

public java.lang.String toString()

isComparableWith

public boolean isComparableWith(Level o)
Description copied from interface: Level
This method returns true is the current level and the Level parameter are ordered.

Specified by:
isComparableWith in interface Level

compareTo

public int compareTo(Level o)
Description copied from interface: Level
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface Level

getIntValue

public int getIntValue()
Description copied from interface: Level
Returns the integer value which represents the level.

Specified by:
getIntValue in interface Level

getName

public java.lang.String getName()
Description copied from interface: Level
It retrieves the name of the Level

Specified by:
getName in interface Level

setName

public void setName(java.lang.String n)
Description copied from interface: Level
It assigns the name of the Level

Specified by:
setName in interface Level