Class ExpressionFactory
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.impl.ExpressionFactory
-
public final class ExpressionFactory extends java.lang.ObjectUsed 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 Nodeefparentprivate 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()ExpressionarrayIndex(Expression expr, Expression index)ExpressionarrayLength(Expression expr)ExpressionbinaryOperator(Expression left, ExpressionFactory.BinaryOperator op, Expression right)Expressioncall(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.Expressioncall(Expression target, java.lang.String ident, Signature signature, java.util.List<Expression> exprs)Construct a representation of a non-static method invocation.Expressioncast(Type type, Expression expr)(package private) static java.util.List<Expression>copyExpressionList(Node newParent, java.util.List<Expression> exprs)Nodeefparent()ExpressionfieldAccess(Expression target, java.lang.String fieldName)ExpressionfieldAccess(Type target, java.lang.String fieldName)ExpressionifExpression(Expression condition, Expression truePart, Expression falsePart)Expressioninstof(Expression expr, Type type)ExpressionnewArr(Type type, Expression size)ExpressionnewArrInit(Type type, java.util.List<Expression> exprs)ExpressionnewObj(Type type, java.util.List<Expression> exprs)ExpressionnewObj(Type type, Signature signature, java.util.List<Expression> args)ExpressionstaticCall(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.ExpressionstaticCall(Type target, java.lang.String ident, Signature signature, java.util.List<Expression> exprs)Construct a representation of a static method invocation.ExpressionsuperCall(java.lang.String ident, java.util.List<Expression> exprs)ExpressionsuperCall(java.lang.String ident, Signature signature, java.util.List<Expression> exprs)ExpressionsuperObj(java.util.List<Expression> exprs)Call to superclass constructor.ExpressionsuperObj(Signature signature, java.util.List<Expression> exprs)Call to superclass constructor.ExpressionthisObj(java.util.List<Expression> exprs)Call to another constructor.ExpressionthisObj(Signature signature, java.util.List<Expression> exprs)Call to another constructor.ExpressionunaryOp(ExpressionFactory.UnaryOperator op, Expression expr)java.util.IdentityHashMap<Expression,java.lang.Boolean>unusedExpressions()Variablevariable(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)
-
-