Package org.jboss.jdeparser
Interface JExpr
-
- All Known Subinterfaces:
JAnonymousClassDef,JArrayExpr,JAssignableExpr,JCall,JLambda
- All Known Implementing Classes:
AbstractJAssignableExpr,AbstractJCall,AbstractJExpr,AbstractMethodJCall,ArrayLookupJExpr,AssignmentJExpr,BinaryJExpr,BooleanJExpr,CastJExpr,CharJExpr,CondJExpr,DecimalDoubleJExpr,DecimalFloatJExpr,DirectJCall,FieldRefJExpr,HexDoubleJExpr,HexFloatJExpr,ImplJAnonymousClassDef,IncDecJExpr,InnerJAnonymousClassDef,InnerNewJCall,InstanceJCall,InstanceOfJExpr,IntegerJExpr,JLambdaImpl,KeywordJCall,KeywordJExpr,LongJExpr,MethodRefJExpr,NameJExpr,NewDimJArrayExpr,NewJCall,NewUndimJArrayExpr,ParenJExpr,PlainJArrayExpr,StaticJCall,StaticRefJExpr,StringJExpr,UnaryJExpr
public interface JExprA modelled expression. Constructed complex expressions are reusable (their contents will be copied at every use site). The minimum number of parentheses will automatically be added as needed. For convenience methods to construct common expressions, also see theJExprsclass.
-
-
Field Summary
Fields Modifier and Type Field Description static JExprFALSEThe constant expression forfalse.static JExprNULLThe constant expression fornull.static JExprONEThe constant expression for the integer one.static JExprTHISThe constant expression forthis.static JExprTRUEThe constant expression fortrue.static JExprZEROThe constant expression for the integer zero.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JExpr_instanceof(java.lang.Class<?> type)Get a type-testing expression using theinstanceofoperator.JExpr_instanceof(java.lang.String type)Get a type-testing expression using theinstanceofoperator.JExpr_instanceof(JType type)Get a type-testing expression using theinstanceofoperator.JCall_new(java.lang.Class<?> type)Get an expression to construct a new inner class instance of this instance expression.JCall_new(java.lang.String type)Get an expression to construct a new inner class instance of this instance expression.JCall_new(JType type)Get an expression to construct a new inner class instance of this instance expression.JAnonymousClassDef_newAnon(java.lang.Class<?> type)Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.JAnonymousClassDef_newAnon(java.lang.String type)Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.JAnonymousClassDef_newAnon(JType type)Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.JAssignableExpr$v(java.lang.String name)Get a field of this object instance (shorthand forfield(String).JExprand(JExpr e1)Combine this expression with another using the binary&&operator.JExprband(JExpr e1)Combine this expression with another using the binary&operator.JExprbor(JExpr e1)Combine this expression with another using the binary|operator.JExprbxor(JExpr e1)Combine this expression with another using the binary^operator.JCallcall(java.lang.String name)Call the given method on this expression.JExprcast(java.lang.Class<?> type)Get an expression which is a cast of this expression to the given type.JExprcast(java.lang.String type)Get an expression which is a cast of this expression to the given type.JExprcast(JType type)Get an expression which is a cast of this expression to the given type.JExprcomp()Invert this expression using the unary~operator.JExprcond(JExpr ifTrue, JExpr ifFalse)Combine this expression with two others using the ternary? :operator.JExprdiv(JExpr e1)Combine this expression with another using the binary/operator.JExpreq(JExpr e1)Combine this expression with another using the binary==operator.JAssignableExprfield(java.lang.String name)Get a field of this object instance.JExprge(JExpr e1)Combine this expression with another using the binary>=operator.JExprgt(JExpr e1)Combine this expression with another using the binary>operator.JExpridx(int idx)Get an element of this array expression.JAssignableExpridx(JExpr idx)Get an element of this array expression.JExprle(JExpr e1)Combine this expression with another using the binary<=operator.JExprlength()Get thelengthexpression of this array expression.JExprlshr(JExpr e1)Combine this expression with another using the binary>>>operator.JExprlt(JExpr e1)Combine this expression with another using the binary<operator.JExprminus(JExpr e1)Combine this expression with another using the binary-operator.JExprmod(JExpr e1)Combine this expression with another using the binary%operator.JExprne(JExpr e1)Combine this expression with another using the binary!=operator.JExprneg()Negate this expression using the unary-operator.JExprnot()Invert this expression using the unary!operator.JExpror(JExpr e1)Combine this expression with another using the binary||operator.JExprparen()Explicitly wrap this expression in parentheses.JExprplus(JExpr e1)Combine this expression with another using the binary+operator.JExprshl(JExpr e1)Combine this expression with another using the binary<<operator.JExprshr(JExpr e1)Combine this expression with another using the binary>>operator.JExprtimes(JExpr e1)Combine this expression with another using the binary*operator.
-
-
-
Field Detail
-
FALSE
static final JExpr FALSE
The constant expression forfalse.
-
TRUE
static final JExpr TRUE
The constant expression fortrue.
-
THIS
static final JExpr THIS
The constant expression forthis.
-
NULL
static final JExpr NULL
The constant expression fornull.
-
ZERO
static final JExpr ZERO
The constant expression for the integer zero.
-
ONE
static final JExpr ONE
The constant expression for the integer one.
-
-
Method Detail
-
plus
JExpr plus(JExpr e1)
Combine this expression with another using the binary+operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
minus
JExpr minus(JExpr e1)
Combine this expression with another using the binary-operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
times
JExpr times(JExpr e1)
Combine this expression with another using the binary*operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
div
JExpr div(JExpr e1)
Combine this expression with another using the binary/operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
mod
JExpr mod(JExpr e1)
Combine this expression with another using the binary%operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
neg
JExpr neg()
Negate this expression using the unary-operator.- Returns:
- the new expression
-
band
JExpr band(JExpr e1)
Combine this expression with another using the binary&operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
bor
JExpr bor(JExpr e1)
Combine this expression with another using the binary|operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
bxor
JExpr bxor(JExpr e1)
Combine this expression with another using the binary^operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
shr
JExpr shr(JExpr e1)
Combine this expression with another using the binary>>operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
lshr
JExpr lshr(JExpr e1)
Combine this expression with another using the binary>>>operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
shl
JExpr shl(JExpr e1)
Combine this expression with another using the binary<<operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
comp
JExpr comp()
Invert this expression using the unary~operator.- Returns:
- the new expression
-
and
JExpr and(JExpr e1)
Combine this expression with another using the binary&&operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
or
JExpr or(JExpr e1)
Combine this expression with another using the binary||operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
not
JExpr not()
Invert this expression using the unary!operator.- Returns:
- the new expression
-
eq
JExpr eq(JExpr e1)
Combine this expression with another using the binary==operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
ne
JExpr ne(JExpr e1)
Combine this expression with another using the binary!=operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
lt
JExpr lt(JExpr e1)
Combine this expression with another using the binary<operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
gt
JExpr gt(JExpr e1)
Combine this expression with another using the binary>operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
le
JExpr le(JExpr e1)
Combine this expression with another using the binary<=operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
ge
JExpr ge(JExpr e1)
Combine this expression with another using the binary>=operator.- Parameters:
e1- the other expression- Returns:
- the combined expression
-
cond
JExpr cond(JExpr ifTrue, JExpr ifFalse)
Combine this expression with two others using the ternary? :operator.- Parameters:
ifTrue- thetrueexpression branchifFalse- thefalseexpression branch- Returns:
- the combined expression
-
paren
JExpr paren()
Explicitly wrap this expression in parentheses.- Returns:
- the wrapped expression
-
_instanceof
JExpr _instanceof(java.lang.String type)
Get a type-testing expression using theinstanceofoperator.- Parameters:
type- the type to test- Returns:
- the expression
-
_instanceof
JExpr _instanceof(JType type)
Get a type-testing expression using theinstanceofoperator.- Parameters:
type- the type to test- Returns:
- the expression
-
_instanceof
JExpr _instanceof(java.lang.Class<?> type)
Get a type-testing expression using theinstanceofoperator.- Parameters:
type- the type to test- Returns:
- the expression
-
cast
JExpr cast(java.lang.String type)
Get an expression which is a cast of this expression to the given type.- Parameters:
type- the type to cast to- Returns:
- the expression
-
cast
JExpr cast(JType type)
Get an expression which is a cast of this expression to the given type.- Parameters:
type- the type to cast to- Returns:
- the expression
-
cast
JExpr cast(java.lang.Class<?> type)
Get an expression which is a cast of this expression to the given type.- Parameters:
type- the type to cast to- Returns:
- the expression
-
call
JCall call(java.lang.String name)
Call the given method on this expression.- Parameters:
name- the method name- Returns:
- the method call
-
_new
JCall _new(java.lang.String type)
Get an expression to construct a new inner class instance of this instance expression.- Parameters:
type- the inner class type to construct- Returns:
- the
newconstructor call
-
_new
JCall _new(JType type)
Get an expression to construct a new inner class instance of this instance expression.- Parameters:
type- the inner class type to construct- Returns:
- the
newconstructor call
-
_new
JCall _new(java.lang.Class<?> type)
Get an expression to construct a new inner class instance of this instance expression.- Parameters:
type- the inner class type to construct- Returns:
- the
newconstructor call
-
_newAnon
JAnonymousClassDef _newAnon(java.lang.String type)
Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.- Parameters:
type- the type of object to construct- Returns:
- the anonymous subclass definition
-
_newAnon
JAnonymousClassDef _newAnon(JType type)
Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.- Parameters:
type- the type of object to construct- Returns:
- the anonymous subclass definition
-
_newAnon
JAnonymousClassDef _newAnon(java.lang.Class<?> type)
Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.- Parameters:
type- the type of object to construct- Returns:
- the anonymous subclass definition
-
field
JAssignableExpr field(java.lang.String name)
Get a field of this object instance.- Parameters:
name- the field name- Returns:
- the expression
-
$v
JAssignableExpr $v(java.lang.String name)
Get a field of this object instance (shorthand forfield(String).- Parameters:
name- the field name- Returns:
- the expression
-
idx
JAssignableExpr idx(JExpr idx)
Get an element of this array expression.- Parameters:
idx- the array index expression- Returns:
- the array dereference expression
-
idx
JExpr idx(int idx)
Get an element of this array expression.- Parameters:
idx- the array index- Returns:
- the array dereference expression
-
length
JExpr length()
Get thelengthexpression of this array expression.- Returns:
- the
lengthexpression
-
-