Class ExpressionFactory
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.impl.ExpressionFactory
-
public final class ExpressionFactory extends java.lang.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
-
Field Summary
Fields Modifier and Type Field Description private Node
efparent
private java.util.IdentityHashMap<Expression,java.lang.Boolean>
unusedExpressions
-
Constructor Summary
Constructors Constructor Description ExpressionFactory(Node parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(java.lang.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, java.lang.String ident, java.util.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, java.lang.String ident, Signature signature, java.util.List<Expression> exprs)
Construct a representation of a non-static method invocation.Expression
cast(Type type, Expression expr)
(package private) static java.util.List<Expression>
copyExpressionList(Node newParent, java.util.List<Expression> exprs)
Node
efparent()
Expression
fieldAccess(Expression target, java.lang.String fieldName)
Expression
fieldAccess(Type target, java.lang.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, java.util.List<Expression> exprs)
Expression
newObj(Type type, java.util.List<Expression> exprs)
Expression
newObj(Type type, Signature signature, java.util.List<Expression> args)
Expression
staticCall(Type target, java.lang.String ident, java.util.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, java.lang.String ident, Signature signature, java.util.List<Expression> exprs)
Construct a representation of a static method invocation.Expression
superCall(java.lang.String ident, java.util.List<Expression> exprs)
Expression
superCall(java.lang.String ident, Signature signature, java.util.List<Expression> exprs)
Expression
superObj(java.util.List<Expression> exprs)
Call to superclass constructor.Expression
superObj(Signature signature, java.util.List<Expression> exprs)
Call to superclass constructor.Expression
thisObj(java.util.List<Expression> exprs)
Call to another constructor.Expression
thisObj(Signature signature, java.util.List<Expression> exprs)
Call to another constructor.Expression
unaryOp(ExpressionFactory.UnaryOperator op, Expression expr)
java.util.IdentityHashMap<Expression,java.lang.Boolean>
unusedExpressions()
Variable
variable(Type type, java.lang.String ident)
-
-
-
Field Detail
-
efparent
private final Node efparent
-
unusedExpressions
private final java.util.IdentityHashMap<Expression,java.lang.Boolean> unusedExpressions
-
-
Constructor Detail
-
ExpressionFactory
public ExpressionFactory(Node parent)
-
-
Method Detail
-
efparent
public final Node efparent()
-
unusedExpressions
public final java.util.IdentityHashMap<Expression,java.lang.Boolean> unusedExpressions()
-
copyExpressionList
static java.util.List<Expression> copyExpressionList(Node newParent, java.util.List<Expression> exprs)
-
_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(java.lang.String c)
-
_const
public ExpressionInternal _const(Type c)
-
_void
public ExpressionInternal _void()
-
_this
public ExpressionInternal _this()
-
call
public Expression call(Expression target, java.lang.String ident, Signature signature, java.util.List<Expression> exprs)
Construct a representation of a non-static method invocation.
-
call
public Expression call(Expression target, java.lang.String ident, java.util.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, java.lang.String ident, Signature signature, java.util.List<Expression> exprs)
Construct a representation of a static method invocation.
-
staticCall
public Expression staticCall(Type target, java.lang.String ident, java.util.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, java.util.List<Expression> args)
-
newObj
public Expression newObj(Type type, java.util.List<Expression> exprs)
-
newArrInit
public Expression newArrInit(Type type, java.util.List<Expression> exprs)
-
newArr
public Expression newArr(Type type, Expression size)
-
superCall
public Expression superCall(java.lang.String ident, Signature signature, java.util.List<Expression> exprs)
-
superCall
public Expression superCall(java.lang.String ident, java.util.List<Expression> exprs)
-
superObj
public Expression superObj(Signature signature, java.util.List<Expression> exprs)
Call to superclass constructor. Must be first in the method.
-
superObj
public Expression superObj(java.util.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, java.util.List<Expression> exprs)
Call to another constructor. Must be first in the method.
-
thisObj
public Expression thisObj(java.util.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, java.lang.String fieldName)
-
fieldAccess
public Expression fieldAccess(Type target, java.lang.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)
-
-