Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

de.hunsicker.jalopy.language
Class LoggerTransformation  view LoggerTransformation download LoggerTransformation.java

java.lang.Object
  extended byde.hunsicker.jalopy.language.TreeWalker
      extended byde.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 $

Field Summary
private  java.util.List _calls
           
private static de.hunsicker.antlr.ASTFactory AST_FACTORY
           
private static java.lang.String DEBUG
           
private static java.lang.String LEVEL_DEBUG
           
private static java.lang.String LOCALIZED_LOG
           
private static java.lang.String PRIORITY_DEBUG
           
 
Fields inherited from class de.hunsicker.jalopy.language.TreeWalker
stop
 
Constructor Summary
(package private) LoggerTransformation()
           
 
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 de.hunsicker.jalopy.language.TreeWalker
reset, stop, walk, walkChildren, walkNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

LoggerTransformation

LoggerTransformation()
Method Detail

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.