org.japano.el
Class JavaExpression

java.lang.Object
  extended by org.japano.el.JavaExpression

public class JavaExpression
extends java.lang.Object

A single java code expression. A JavaExpression consists of its code and the class type of that code. The generated code will call methods of EL where the type is indefinite.

Version:
$Id: JavaExpression.java,v 1.8 2005/10/06 07:12:26 fforw Exp $ SourceForge.net Logo
Author:
Sven Helmberger ( sven dot helmberger at gmx dot de )

Nested Class Summary
static class JavaExpression.Identifier
          Dummy class to represent an identifier
static class JavaExpression.StringLiteral
          Dummy class to represent a String literal
 
Constructor Summary
JavaExpression(java.lang.Class type, java.lang.String code)
          Constructs a new JavaExpression with the given code of the given type.
 
Method Summary
 JavaExpression aritmethicOp(org.japano.el.parser.Token op, JavaExpression that)
           
 JavaExpression chain(org.japano.el.parser.Token op, JavaExpression that)
           
 JavaExpression concat(JavaExpression that)
          Generates code for a string concatenation of this expression and a given other expression.
static JavaExpression conditionalExpression(JavaExpression boolExpr, JavaExpression trueExpr, JavaExpression falseExpr)
           
 JavaExpression convertTo(java.lang.Class targetType)
          Ensures that this expression will have the given type at runtime.
 java.lang.String convertToBoolean()
           
 JavaExpression convertToCompileTime(java.lang.Class targetType)
          Converts this expression to the given type ensuring that it will also have an appropriate compile time type.
 java.lang.String convertToObject()
           
 java.lang.String convertToString()
           
 JavaExpression equalityOp(org.japano.el.parser.Token op, JavaExpression that)
           
 java.lang.String getCode()
          Returns the code of this expression.
 java.lang.Class getType()
          Returns the type of this expression.
 boolean isBoolean()
           
 boolean isStringLiteral()
           
 JavaExpression logicOp(org.japano.el.parser.Token op, JavaExpression that)
           
 JavaExpression negate()
           
 JavaExpression not()
           
 JavaExpression relationalOp(org.japano.el.parser.Token op, JavaExpression that)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaExpression

public JavaExpression(java.lang.Class type,
                      java.lang.String code)
Constructs a new JavaExpression with the given code of the given type.

Method Detail

getCode

public java.lang.String getCode()
Returns the code of this expression.


getType

public java.lang.Class getType()
Returns the type of this expression.


concat

public JavaExpression concat(JavaExpression that)
Generates code for a string concatenation of this expression and a given other expression.


aritmethicOp

public JavaExpression aritmethicOp(org.japano.el.parser.Token op,
                                   JavaExpression that)

logicOp

public JavaExpression logicOp(org.japano.el.parser.Token op,
                              JavaExpression that)

relationalOp

public JavaExpression relationalOp(org.japano.el.parser.Token op,
                                   JavaExpression that)

not

public JavaExpression not()

negate

public JavaExpression negate()

isBoolean

public boolean isBoolean()

convertToCompileTime

public JavaExpression convertToCompileTime(java.lang.Class targetType)
Converts this expression to the given type ensuring that it will also have an appropriate compile time type. If the nescessary type conversion is not possible, the resulting expression will cause an compiler error.

Parameters:
targetType - desired type
Returns:
expression with desired compile time type

convertTo

public JavaExpression convertTo(java.lang.Class targetType)
Ensures that this expression will have the given type at runtime. if the nescessary type conversion is not possible, the evaluation of the expression will lead to an ELException at runtime.

Parameters:
targetType - desired type
Returns:
an expression with the desired runtime type

convertToBoolean

public java.lang.String convertToBoolean()

convertToObject

public java.lang.String convertToObject()

chain

public JavaExpression chain(org.japano.el.parser.Token op,
                            JavaExpression that)

equalityOp

public JavaExpression equalityOp(org.japano.el.parser.Token op,
                                 JavaExpression that)

convertToString

public java.lang.String convertToString()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

conditionalExpression

public static JavaExpression conditionalExpression(JavaExpression boolExpr,
                                                   JavaExpression trueExpr,
                                                   JavaExpression falseExpr)

isStringLiteral

public boolean isStringLiteral()