Package com.sun.codemodel
Interface JExpression
- All Superinterfaces:
JGenerable
- All Known Subinterfaces:
JAssignmentTarget
- All Known Implementing Classes:
JArray
,JArrayCompRef
,JAssignment
,JCast
,JEnumConstant
,JExpressionImpl
,JFieldRef
,JFieldVar
,JInvocation
,JStringLiteral
,JVar
A Java expression.
Unlike most of CodeModel, JExpressions are built bottom-up ( meaning you start from leaves and then gradually build compliated expressions by combining them.)
JExpression
defines a series of composer methods,
which returns a complicated expression (by often taking other JExpression
s
as parameters.
For example, you can build "5+2" by
JExpr.lit(5).add(JExpr.lit(2))
-
Method Summary
Modifier and TypeMethodDescription_instanceof
(JType right) Returns "[this] instanceof [right]"band
(JExpression right) Bit-wise AND '&'.bor
(JExpression right) Bit-wise OR '|'.cand
(JExpression right) Logical AND '&&'.Returns "~[this]" from "[this]".component
(JExpression index) cor
(JExpression right) Logical OR '||'.decr()
Returns "[this]--" from "[this]".div
(JExpression right) Returns "[this]/[right]"eq
(JExpression right) gt
(JExpression right) gte
(JExpression right) incr()
Returns "[this]++" from "[this]".Returns "[this].[method]".Returns "[this].[method]".lt
(JExpression right) lte
(JExpression right) minus()
Returns "-[this]" from "[this]".minus
(JExpression right) Returns "[this]-[right]"mod
(JExpression right) Returns "[this]%[right]"mul
(JExpression right) Returns "[this]*[right]"ne
(JExpression right) not()
Returns "![this]" from "[this]".plus
(JExpression right) Returns "[this]+[right]"shl
(JExpression right) Returns "[this]<<[right]"shr
(JExpression right) Returns "[this]>>[right]
"shrz
(JExpression right) Returns "[this]>>>[right]
"xor
(JExpression right) Methods inherited from interface com.sun.codemodel.JGenerable
generate
-
Method Details
-
minus
JExpression minus()Returns "-[this]" from "[this]". -
not
JExpression not()Returns "![this]" from "[this]". -
complement
JExpression complement()Returns "~[this]" from "[this]". -
incr
JExpression incr()Returns "[this]++" from "[this]". -
decr
JExpression decr()Returns "[this]--" from "[this]". -
plus
Returns "[this]+[right]" -
minus
Returns "[this]-[right]" -
mul
Returns "[this]*[right]" -
div
Returns "[this]/[right]" -
mod
Returns "[this]%[right]" -
shl
Returns "[this]<<[right]" -
shr
Returns "[this]>>[right]
" -
shrz
Returns "[this]>>>[right]
" -
band
Bit-wise AND '&'. -
bor
Bit-wise OR '|'. -
cand
Logical AND '&&'. -
cor
Logical OR '||'. -
xor
-
lt
-
lte
-
gt
-
gte
-
eq
-
ne
-
_instanceof
Returns "[this] instanceof [right]" -
invoke
Returns "[this].[method]". Arguments shall be added to the returnedJInvocation
object. -
invoke
Returns "[this].[method]". Arguments shall be added to the returnedJInvocation
object. -
ref
-
ref
-
component
-