Package org.jboss.jdeparser
Interface JExpr
- All Known Subinterfaces:
JAnonymousClassDef
,JArrayExpr
,JAssignableExpr
,JCall
,JLambda
public interface JExpr
A 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 the
JExprs
class.- Author:
- David M. Lloyd
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JExpr
The constant expression forfalse
.static final JExpr
The constant expression fornull
.static final JExpr
The constant expression for the integer one.static final JExpr
The constant expression forthis
.static final JExpr
The constant expression fortrue
.static final JExpr
The constant expression for the integer zero. -
Method Summary
Modifier and TypeMethodDescription_instanceof
(Class<?> type) Get a type-testing expression using theinstanceof
operator._instanceof
(String type) Get a type-testing expression using theinstanceof
operator._instanceof
(JType type) Get a type-testing expression using theinstanceof
operator.Get an expression to construct a new inner class instance of this instance expression.Get an expression to construct a new inner class instance of this instance expression.Get an expression to construct a new inner class instance of this instance expression.Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.Get a field of this object instance (shorthand forfield(String)
.Combine this expression with another using the binary&&
operator.Combine this expression with another using the binary&
operator.Combine this expression with another using the binary|
operator.Combine this expression with another using the binary^
operator.Call the given method on this expression.Get an expression which is a cast of this expression to the given type.Get an expression which is a cast of this expression to the given type.Get an expression which is a cast of this expression to the given type.comp()
Invert this expression using the unary~
operator.Combine this expression with two others using the ternary? :
operator.Combine this expression with another using the binary/
operator.Combine this expression with another using the binary==
operator.Get a field of this object instance.Combine this expression with another using the binary>=
operator.Combine this expression with another using the binary>
operator.idx
(int idx) Get an element of this array expression.Get an element of this array expression.Combine this expression with another using the binary<=
operator.length()
Get thelength
expression of this array expression.Combine this expression with another using the binary>>>
operator.Combine this expression with another using the binary<
operator.Combine this expression with another using the binary-
operator.Combine this expression with another using the binary%
operator.Combine this expression with another using the binary!=
operator.neg()
Negate this expression using the unary-
operator.not()
Invert this expression using the unary!
operator.Combine this expression with another using the binary||
operator.paren()
Explicitly wrap this expression in parentheses.Combine this expression with another using the binary+
operator.Combine this expression with another using the binary<<
operator.Combine this expression with another using the binary>>
operator.Combine this expression with another using the binary*
operator.
-
Field Details
-
FALSE
The constant expression forfalse
. -
TRUE
The constant expression fortrue
. -
THIS
The constant expression forthis
. -
NULL
The constant expression fornull
. -
ZERO
The constant expression for the integer zero. -
ONE
The constant expression for the integer one.
-
-
Method Details
-
plus
Combine this expression with another using the binary+
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
minus
Combine this expression with another using the binary-
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
times
Combine this expression with another using the binary*
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
div
Combine this expression with another using the binary/
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
mod
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
Combine this expression with another using the binary&
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
bor
Combine this expression with another using the binary|
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
bxor
Combine this expression with another using the binary^
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
shr
Combine this expression with another using the binary>>
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
lshr
Combine this expression with another using the binary>>>
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
shl
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
Combine this expression with another using the binary&&
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
or
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
Combine this expression with another using the binary==
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
ne
Combine this expression with another using the binary!=
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
lt
Combine this expression with another using the binary<
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
gt
Combine this expression with another using the binary>
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
le
Combine this expression with another using the binary<=
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
ge
Combine this expression with another using the binary>=
operator.- Parameters:
e1
- the other expression- Returns:
- the combined expression
-
cond
Combine this expression with two others using the ternary? :
operator.- Parameters:
ifTrue
- thetrue
expression branchifFalse
- thefalse
expression branch- Returns:
- the combined expression
-
paren
JExpr paren()Explicitly wrap this expression in parentheses.- Returns:
- the wrapped expression
-
_instanceof
Get a type-testing expression using theinstanceof
operator.- Parameters:
type
- the type to test- Returns:
- the expression
-
_instanceof
Get a type-testing expression using theinstanceof
operator.- Parameters:
type
- the type to test- Returns:
- the expression
-
_instanceof
Get a type-testing expression using theinstanceof
operator.- Parameters:
type
- the type to test- Returns:
- the expression
-
cast
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
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
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
Call the given method on this expression.- Parameters:
name
- the method name- Returns:
- the method call
-
_new
Get an expression to construct a new inner class instance of this instance expression.- Parameters:
type
- the inner class type to construct- Returns:
- the
new
constructor call
-
_new
Get an expression to construct a new inner class instance of this instance expression.- Parameters:
type
- the inner class type to construct- Returns:
- the
new
constructor call
-
_new
Get an expression to construct a new inner class instance of this instance expression.- Parameters:
type
- the inner class type to construct- Returns:
- the
new
constructor call
-
_newAnon
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
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
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
Get a field of this object instance.- Parameters:
name
- the field name- Returns:
- the expression
-
$v
Get a field of this object instance (shorthand forfield(String)
.- Parameters:
name
- the field name- Returns:
- the expression
-
idx
Get an element of this array expression.- Parameters:
idx
- the array index expression- Returns:
- the array dereference expression
-
idx
Get an element of this array expression.- Parameters:
idx
- the array index- Returns:
- the array dereference expression
-
length
JExpr length()Get thelength
expression of this array expression.- Returns:
- the
length
expression
-