org.japano.el
Class JavaExpressionGenerator

java.lang.Object
  extended by org.japano.el.JavaExpressionGenerator
All Implemented Interfaces:
org.japano.el.parser.ELParserVisitor

public class JavaExpressionGenerator
extends java.lang.Object
implements org.japano.el.parser.ELParserVisitor

Transforms an EL syntax tree into an optimized java expression.

Version:
$Id: JavaExpressionGenerator.java,v 1.24 2005/10/19 22:26:57 fforw Exp $ SourceForge.net Logo
Author:
Sven Helmberger ( sven dot helmberger at gmx dot de )

Constructor Summary
JavaExpressionGenerator(org.japano.jasper.compiler.CompilationContext context, boolean jspExpressions)
          Creates a new instance of ELCompiler
 
Method Summary
static void doMain(java.lang.String[] args)
          Transforms the first argument into a JavaExpression or asks the user to input one.
static void main(java.lang.String[] args)
           
 JavaExpression transform(org.japano.el.parser.Node n, java.lang.Class targetType, org.japano.jasper.compiler.Node baseNode)
           
 JavaExpression transform(java.lang.String expression, boolean ELIgnored, java.lang.Class targetType, org.japano.jasper.compiler.Node baseNode)
          Transforms the given EL syntax tree into a JavaExpression.
static java.lang.String unescape(java.lang.String s)
           
 java.lang.Object visit(org.japano.el.parser.ELAdditiveExpression node, java.lang.Object data)
          Visit an ELAdditiveExpression node.
 java.lang.Object visit(org.japano.el.parser.ELAndExpression node, java.lang.Object data)
          Visit an ELAndExpression node.
 java.lang.Object visit(org.japano.el.parser.ELChainedExpression node, java.lang.Object data)
          Visit an ELChainedExpression node.
 java.lang.Object visit(org.japano.el.parser.ELConditionalExpression node, java.lang.Object data)
          Visit an ELConditionalExpression Node.
 java.lang.Object visit(org.japano.el.parser.ELEqualityExpression node, java.lang.Object data)
          Visit an ELEqualityExpression node.
 java.lang.Object visit(org.japano.el.parser.ELFunctionInvocation node, java.lang.Object data)
           
 java.lang.Object visit(org.japano.el.parser.ELIdentifier node, java.lang.Object data)
          Visit an ELIdentifier node.
 java.lang.Object visit(org.japano.el.parser.ELLiteral node, java.lang.Object data)
          Visit an ELLiteral node
 java.lang.Object visit(org.japano.el.parser.ELMultiplicativeExpression node, java.lang.Object data)
          Visit an ELMultiplicativeExpression node.
 java.lang.Object visit(org.japano.el.parser.ELNonExpressionText node, java.lang.Object data)
          Visit an ELNonExpressionText Node.
 java.lang.Object visit(org.japano.el.parser.ELOrExpression node, java.lang.Object data)
          Visit an ELOrExpression node.
 java.lang.Object visit(org.japano.el.parser.ELRelationExpression node, java.lang.Object data)
          Visit an ELRelationExpression node.
 java.lang.Object visit(org.japano.el.parser.ELRoot node, java.lang.Object data)
          Visit an ELRoot Node
 java.lang.Object visit(org.japano.el.parser.ELUnaryExpression node, java.lang.Object data)
          Visit an ELUnaryExpression node.
 java.lang.Object visit(org.japano.el.parser.SimpleNode node, java.lang.Object data)
          Visit a SimpleNode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaExpressionGenerator

public JavaExpressionGenerator(org.japano.jasper.compiler.CompilationContext context,
                               boolean jspExpressions)
Creates a new instance of ELCompiler

Parameters:
context - compilation context
jspExpressions - if true, JSP Expressions will be handled in non-EL-Expression Text.
Method Detail

transform

public JavaExpression transform(java.lang.String expression,
                                boolean ELIgnored,
                                java.lang.Class targetType,
                                org.japano.jasper.compiler.Node baseNode)
                         throws org.japano.el.parser.ParseException
Transforms the given EL syntax tree into a JavaExpression.

Parameters:
expression - EL expression to transform into a java expression
ELIgnored - if true, ELExpressions are ignored and only JSP expression are evaluated.
targetType - type the returned java expression should have. null for any type.
Returns:
java expression
Throws:
org.japano.el.parser.ParseException

transform

public JavaExpression transform(org.japano.el.parser.Node n,
                                java.lang.Class targetType,
                                org.japano.jasper.compiler.Node baseNode)

visit

public java.lang.Object visit(org.japano.el.parser.ELRoot node,
                              java.lang.Object data)
Visit an ELRoot Node

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELRoot
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELNonExpressionText node,
                              java.lang.Object data)
Visit an ELNonExpressionText Node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELNonExpressionText
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELConditionalExpression node,
                              java.lang.Object data)
Visit an ELConditionalExpression Node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELConditionalExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELAdditiveExpression node,
                              java.lang.Object data)
Visit an ELAdditiveExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELAdditiveExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELMultiplicativeExpression node,
                              java.lang.Object data)
Visit an ELMultiplicativeExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELMultiplicativeExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELOrExpression node,
                              java.lang.Object data)
Visit an ELOrExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELOrExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELAndExpression node,
                              java.lang.Object data)
Visit an ELAndExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELAndExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELUnaryExpression node,
                              java.lang.Object data)
Visit an ELUnaryExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELUnaryExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELRelationExpression node,
                              java.lang.Object data)
Visit an ELRelationExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELRelationExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELEqualityExpression node,
                              java.lang.Object data)
Visit an ELEqualityExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELEqualityExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELLiteral node,
                              java.lang.Object data)
Visit an ELLiteral node

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELLiteral
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELIdentifier node,
                              java.lang.Object data)
Visit an ELIdentifier node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELIdentifier
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELChainedExpression node,
                              java.lang.Object data)
Visit an ELChainedExpression node.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - ELChainedExpression
data - null
Returns:
JavaExpression

visit

public java.lang.Object visit(org.japano.el.parser.ELFunctionInvocation node,
                              java.lang.Object data)
Specified by:
visit in interface org.japano.el.parser.ELParserVisitor

visit

public java.lang.Object visit(org.japano.el.parser.SimpleNode node,
                              java.lang.Object data)
Visit a SimpleNode. This method will never be called and is only there because JJTree created it.

Specified by:
visit in interface org.japano.el.parser.ELParserVisitor
Parameters:
node - SimpleNode
data - null
Returns:
JavaExpression

doMain

public static void doMain(java.lang.String[] args)
                   throws org.japano.el.parser.ParseException
Transforms the first argument into a JavaExpression or asks the user to input one.

Parameters:
args - arguments
Throws:
java.lang.Exception
org.japano.el.parser.ParseException

unescape

public static java.lang.String unescape(java.lang.String s)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception