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

java.lang.Object
  extended by org.objectweb.util.monolog.wrapper.common.LevelImpl
All Implemented Interfaces:
Serializable, Level

public class LevelImpl
extends Object
implements Level, 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(String n, int val)
           
LevelImpl(String n, String val, LevelFactory lf)
           
 
Method Summary
 int compareTo(Level o)
           
static int evaluate(String expr, LevelFactory lf)
          It analyzes a string expression to obtain its integer value.
 int getIntValue()
           
 String getName()
           
 String getStringValue()
          It retrieves the string expression of the level.
 int hashCode()
          It retrieves the integer value of the level.
 boolean isComparableWith(Level o)
           
 void setName(String n)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LevelImpl

public LevelImpl(String n,
                 int val)

LevelImpl

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

hashCode

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

Overrides:
hashCode in class Object

getStringValue

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


evaluate

public static int evaluate(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.
lf - is the LevelFactory which permits to obtain the referenced level.
Returns:
an integer value or 0 if it is impossible to evaluate the expression.

toString

public String toString()
Overrides:
toString in class Object

isComparableWith

public boolean isComparableWith(Level o)
Specified by:
isComparableWith in interface Level

compareTo

public int compareTo(Level o)
Specified by:
compareTo in interface Level

getIntValue

public int getIntValue()
Specified by:
getIntValue in interface Level

getName

public String getName()
Specified by:
getName in interface Level

setName

public void setName(String n)
Specified by:
setName in interface Level


Copyright © 2012 OW2 Consortium. All Rights Reserved.