org.glassfish.pfl.dynamic.codegen.impl
Class ExpressionFactory

java.lang.Object
  extended by org.glassfish.pfl.dynamic.codegen.impl.ExpressionFactory

public final class ExpressionFactory
extends Object

Used to create all expressions. BlockStatement is used as the factory for creating instances of ExpressionFactory. All statements created by an ExpressionFactory have the BlockStatement that created this ExpressionFactory as their parent. An ExpressionFactory should be used only to create Expression instances in statements inside the creating BlockStatement. Each subtype of Expression is defined as a static inner class in ExpressionFactory.


Nested Class Summary
static class ExpressionFactory.ArrayIndexExpression
           
static class ExpressionFactory.ArrayLengthExpression
           
static class ExpressionFactory.BinaryOperator
          Representation of binary operators.
static class ExpressionFactory.BinaryOperatorExpression
           
static class ExpressionFactory.BinaryOperatorKind
           
static class ExpressionFactory.CallExpression<T>
          Representation of any sort of method call other than a constructor invocation.
static class ExpressionFactory.CastExpression
           
static class ExpressionFactory.ConstantExpression
          Class that represents a constant value of any primitive type, a String, or a Class.
static class ExpressionFactory.ExpressionBase
           
static class ExpressionFactory.FieldAccessExpressionBase<T>
           
static class ExpressionFactory.IfExpression
           
static class ExpressionFactory.InstofExpression
           
static class ExpressionFactory.NewArrExpression
           
static class ExpressionFactory.NewObjExpression
           
static class ExpressionFactory.NonStaticCallExpression
           
static class ExpressionFactory.NonStaticFieldAccessExpression
           
static class ExpressionFactory.StaticCallExpression
           
static class ExpressionFactory.StaticFieldAccessExpression
           
static class ExpressionFactory.SuperCallExpression
           
static class ExpressionFactory.SuperObjExpression
           
static class ExpressionFactory.ThisExpression
          Class used to represent the current object ("this" in java).
static class ExpressionFactory.ThisObjExpression
           
static class ExpressionFactory.UnaryOperator
          Operators that apply to a single expression.
static class ExpressionFactory.UnaryOperatorExpression
          Representation of the application of a UnaryOperator to an Expression.
static class ExpressionFactory.VariableImpl
           
static class ExpressionFactory.VoidExpression
          Class that represents a void expression.
 
Constructor Summary
ExpressionFactory(Node parent)
           
 
Method Summary
 ExpressionInternal _const(boolean c)
           
 ExpressionInternal _const(byte c)
           
 ExpressionInternal _const(char c)
           
 ExpressionInternal _const(double c)
           
 ExpressionInternal _const(float c)
           
 ExpressionInternal _const(int c)
           
 ExpressionInternal _const(long c)
           
 ExpressionInternal _const(short c)
           
 ExpressionInternal _const(String c)
           
 ExpressionInternal _const(Type c)
           
 ExpressionInternal _null()
           
 ExpressionInternal _this()
           
 ExpressionInternal _void()
           
 Expression arrayIndex(Expression expr, Expression index)
           
 Expression arrayLength(Expression expr)
           
 Expression binaryOperator(Expression left, ExpressionFactory.BinaryOperator op, Expression right)
           
 Expression call(Expression target, String ident, List<Expression> exprs)
          Shorthand form to construct invocation that looks up Signature based on the types of the expressions in exprs.
 Expression call(Expression target, String ident, Signature signature, List<Expression> exprs)
          Construct a representation of a non-static method invocation.
 Expression cast(Type type, Expression expr)
           
 Node efparent()
           
 Expression fieldAccess(Expression target, String fieldName)
           
 Expression fieldAccess(Type target, String fieldName)
           
 Expression ifExpression(Expression condition, Expression truePart, Expression falsePart)
           
 Expression instof(Expression expr, Type type)
           
 Expression newArr(Type type, Expression size)
           
 Expression newArrInit(Type type, List<Expression> exprs)
           
 Expression newObj(Type type, List<Expression> exprs)
           
 Expression newObj(Type type, Signature signature, List<Expression> args)
           
 Expression staticCall(Type target, String ident, List<Expression> exprs)
          Shorthand form to construct invocation that looks up Signature based on the types of the expressions in exprs.
 Expression staticCall(Type target, String ident, Signature signature, List<Expression> exprs)
          Construct a representation of a static method invocation.
 Expression superCall(String ident, List<Expression> exprs)
           
 Expression superCall(String ident, Signature signature, List<Expression> exprs)
           
 Expression superObj(List<Expression> exprs)
          Call to superclass constructor.
 Expression superObj(Signature signature, List<Expression> exprs)
          Call to superclass constructor.
 Expression thisObj(List<Expression> exprs)
          Call to another constructor.
 Expression thisObj(Signature signature, List<Expression> exprs)
          Call to another constructor.
 Expression unaryOp(ExpressionFactory.UnaryOperator op, Expression expr)
           
 IdentityHashMap<Expression,Boolean> unusedExpressions()
           
 Variable variable(Type type, String ident)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionFactory

public ExpressionFactory(Node parent)
Method Detail

efparent

public final Node efparent()

unusedExpressions

public final IdentityHashMap<Expression,Boolean> unusedExpressions()

_null

public ExpressionInternal _null()

_const

public ExpressionInternal _const(boolean c)

_const

public ExpressionInternal _const(char c)

_const

public ExpressionInternal _const(byte c)

_const

public ExpressionInternal _const(short c)

_const

public ExpressionInternal _const(int c)

_const

public ExpressionInternal _const(long c)

_const

public ExpressionInternal _const(float c)

_const

public ExpressionInternal _const(double c)

_const

public ExpressionInternal _const(String c)

_const

public ExpressionInternal _const(Type c)

_void

public ExpressionInternal _void()

_this

public ExpressionInternal _this()

call

public Expression call(Expression target,
                       String ident,
                       Signature signature,
                       List<Expression> exprs)
Construct a representation of a non-static method invocation.


call

public Expression call(Expression target,
                       String ident,
                       List<Expression> exprs)
Shorthand form to construct invocation that looks up Signature based on the types of the expressions in exprs. Can probably be used in most circumstances.


staticCall

public Expression staticCall(Type target,
                             String ident,
                             Signature signature,
                             List<Expression> exprs)
Construct a representation of a static method invocation.


staticCall

public Expression staticCall(Type target,
                             String ident,
                             List<Expression> exprs)
Shorthand form to construct invocation that looks up Signature based on the types of the expressions in exprs. Can probably be used in most circumstances.


unaryOp

public Expression unaryOp(ExpressionFactory.UnaryOperator op,
                          Expression expr)

binaryOperator

public Expression binaryOperator(Expression left,
                                 ExpressionFactory.BinaryOperator op,
                                 Expression right)

cast

public Expression cast(Type type,
                       Expression expr)

instof

public Expression instof(Expression expr,
                         Type type)

newObj

public Expression newObj(Type type,
                         Signature signature,
                         List<Expression> args)

newObj

public Expression newObj(Type type,
                         List<Expression> exprs)

newArrInit

public Expression newArrInit(Type type,
                             List<Expression> exprs)

newArr

public Expression newArr(Type type,
                         Expression size)

superCall

public Expression superCall(String ident,
                            Signature signature,
                            List<Expression> exprs)

superCall

public Expression superCall(String ident,
                            List<Expression> exprs)

superObj

public Expression superObj(Signature signature,
                           List<Expression> exprs)
Call to superclass constructor. Must be first in the method.


superObj

public Expression superObj(List<Expression> exprs)
Call to superclass constructor. Must be first in the method. This is a shorthand form that computes the Signature directly from the Expression list exprs.


thisObj

public Expression thisObj(Signature signature,
                          List<Expression> exprs)
Call to another constructor. Must be first in the method.


thisObj

public Expression thisObj(List<Expression> exprs)
Call to another constructor. Must be first in the method. This is a shorthand form that computes the Signature directly from the Expression list exprs.


fieldAccess

public Expression fieldAccess(Expression target,
                              String fieldName)

fieldAccess

public Expression fieldAccess(Type target,
                              String fieldName)

arrayIndex

public Expression arrayIndex(Expression expr,
                             Expression index)

arrayLength

public Expression arrayLength(Expression expr)

ifExpression

public Expression ifExpression(Expression condition,
                               Expression truePart,
                               Expression falsePart)

variable

public Variable variable(Type type,
                         String ident)


Copyright © 2013 Oracle. All Rights Reserved.