java.lang.Object
de.hunsicker.jalopy.language.TreeWalker
de.hunsicker.jalopy.language.LoggerTransformation
- All Implemented Interfaces:
- Transformation
- final class LoggerTransformation
- extends TreeWalker
- implements Transformation
Transformation which checks debug logging statements and adds an enclosing boolean
expression if not yet present.
The current implementation only works for the Jakarta Log4J logging toolkit and is
somewhat weak in that every method call with a name of "debug" will be
recognized as a logging call.
- Version:
- $Revision: 1.3 $
| Fields inherited from class de.hunsicker.jalopy.language.TreeWalker |
stop |
|
Method Summary |
private void |
addConditional(JavaNode expr,
de.hunsicker.antlr.collections.AST name)
Adds a conditional expression for the given debug method call. |
void |
apply(de.hunsicker.antlr.collections.AST tree)
null |
private JavaNode |
createConditional(de.hunsicker.antlr.collections.AST name)
Creates the enclosing conditional expression. |
private boolean |
isDebugCall(de.hunsicker.antlr.collections.AST node,
java.lang.String name)
Determines whether the given node represents a debug call. |
private boolean |
isEnclosed(JavaNode expr)
Determines whether the given expression (denoting a method call) is enclosed with
a conditional expression. |
void |
visit(de.hunsicker.antlr.collections.AST node)
null |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEBUG
private static final java.lang.String DEBUG
- See Also:
- Constant Field Values
LEVEL_DEBUG
private static final java.lang.String LEVEL_DEBUG
- See Also:
- Constant Field Values
LOCALIZED_LOG
private static final java.lang.String LOCALIZED_LOG
- See Also:
- Constant Field Values
PRIORITY_DEBUG
private static final java.lang.String PRIORITY_DEBUG
- See Also:
- Constant Field Values
AST_FACTORY
private static final de.hunsicker.antlr.ASTFactory AST_FACTORY
_calls
private java.util.List _calls
LoggerTransformation
LoggerTransformation()
apply
public void apply(de.hunsicker.antlr.collections.AST tree)
throws TransformationException
- null
- Specified by:
apply in interface Transformation
visit
public void visit(de.hunsicker.antlr.collections.AST node)
- null
- Specified by:
visit in class TreeWalker
isDebugCall
private boolean isDebugCall(de.hunsicker.antlr.collections.AST node,
java.lang.String name)
- Determines whether the given node represents a debug call.
isEnclosed
private boolean isEnclosed(JavaNode expr)
- Determines whether the given expression (denoting a method call) is enclosed with
a conditional expression.
addConditional
private void addConditional(JavaNode expr,
de.hunsicker.antlr.collections.AST name)
- Adds a conditional expression for the given debug method call.
createConditional
private JavaNode createConditional(de.hunsicker.antlr.collections.AST name)
- Creates the enclosing conditional expression.