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 theJExprs
class.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static JExpr
FALSE
The constant expression forfalse
.static JExpr
NULL
The constant expression fornull
.static JExpr
ONE
The constant expression for the integer one.static JExpr
THIS
The constant expression forthis
.static JExpr
TRUE
The constant expression fortrue
.static JExpr
ZERO
The 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 theinstanceof
operator.JExpr
_instanceof(java.lang.String type)
Get a type-testing expression using theinstanceof
operator.JExpr
_instanceof(JType type)
Get a type-testing expression using theinstanceof
operator.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)
.JExpr
and(JExpr e1)
Combine this expression with another using the binary&&
operator.JExpr
band(JExpr e1)
Combine this expression with another using the binary&
operator.JExpr
bor(JExpr e1)
Combine this expression with another using the binary|
operator.JExpr
bxor(JExpr e1)
Combine this expression with another using the binary^
operator.JCall
call(java.lang.String name)
Call the given method on this expression.JExpr
cast(java.lang.Class<?> type)
Get an expression which is a cast of this expression to the given type.JExpr
cast(java.lang.String type)
Get an expression which is a cast of this expression to the given type.JExpr
cast(JType type)
Get an expression which is a cast of this expression to the given type.JExpr
comp()
Invert this expression using the unary~
operator.JExpr
cond(JExpr ifTrue, JExpr ifFalse)
Combine this expression with two others using the ternary? :
operator.JExpr
div(JExpr e1)
Combine this expression with another using the binary/
operator.JExpr
eq(JExpr e1)
Combine this expression with another using the binary==
operator.JAssignableExpr
field(java.lang.String name)
Get a field of this object instance.JExpr
ge(JExpr e1)
Combine this expression with another using the binary>=
operator.JExpr
gt(JExpr e1)
Combine this expression with another using the binary>
operator.JExpr
idx(int idx)
Get an element of this array expression.JAssignableExpr
idx(JExpr idx)
Get an element of this array expression.JExpr
le(JExpr e1)
Combine this expression with another using the binary<=
operator.JExpr
length()
Get thelength
expression of this array expression.JExpr
lshr(JExpr e1)
Combine this expression with another using the binary>>>
operator.JExpr
lt(JExpr e1)
Combine this expression with another using the binary<
operator.JExpr
minus(JExpr e1)
Combine this expression with another using the binary-
operator.JExpr
mod(JExpr e1)
Combine this expression with another using the binary%
operator.JExpr
ne(JExpr e1)
Combine this expression with another using the binary!=
operator.JExpr
neg()
Negate this expression using the unary-
operator.JExpr
not()
Invert this expression using the unary!
operator.JExpr
or(JExpr e1)
Combine this expression with another using the binary||
operator.JExpr
paren()
Explicitly wrap this expression in parentheses.JExpr
plus(JExpr e1)
Combine this expression with another using the binary+
operator.JExpr
shl(JExpr e1)
Combine this expression with another using the binary<<
operator.JExpr
shr(JExpr e1)
Combine this expression with another using the binary>>
operator.JExpr
times(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
- thetrue
expression branchifFalse
- thefalse
expression 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 theinstanceof
operator.- Parameters:
type
- the type to test- Returns:
- the expression
-
_instanceof
JExpr _instanceof(JType type)
Get a type-testing expression using theinstanceof
operator.- Parameters:
type
- the type to test- Returns:
- the expression
-
_instanceof
JExpr _instanceof(java.lang.Class<?> type)
Get a type-testing expression using theinstanceof
operator.- 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
new
constructor 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
new
constructor 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
new
constructor 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 thelength
expression of this array expression.- Returns:
- the
length
expression
-
-