Package org.jboss.jdeparser
Class AbstractJExpr
- java.lang.Object
-
- org.jboss.jdeparser.AbstractJExpr
-
- Direct Known Subclasses:
AbstractJAssignableExpr
,AbstractJCall
,BinaryJExpr
,BooleanJExpr
,CastJExpr
,CharJExpr
,CondJExpr
,DecimalDoubleJExpr
,DecimalFloatJExpr
,HexDoubleJExpr
,HexFloatJExpr
,InstanceOfJExpr
,IntegerJExpr
,JLambdaImpl
,KeywordJExpr
,LongJExpr
,MethodRefJExpr
,NewDimJArrayExpr
,ParenJExpr
,PlainJArrayExpr
,StringJExpr
,UnaryJExpr
abstract class AbstractJExpr extends java.lang.Object implements JExpr, Writable
-
-
Field Summary
Fields Modifier and Type Field Description private CachingLinkedHashMap<java.lang.String,JAssignableExpr>
fieldCache
private JExpr
length
private int
prec
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractJExpr(int prec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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 forJExpr.field(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.(package private) static AbstractJExpr
of(JExpr expr)
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.int
prec()
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
-
prec
private final int prec
-
fieldCache
private CachingLinkedHashMap<java.lang.String,JAssignableExpr> fieldCache
-
length
private JExpr length
-
-
Method Detail
-
of
static AbstractJExpr of(JExpr expr)
-
plus
public JExpr plus(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary+
operator.
-
minus
public JExpr minus(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary-
operator.
-
times
public JExpr times(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary*
operator.
-
div
public JExpr div(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary/
operator.
-
mod
public JExpr mod(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary%
operator.
-
neg
public JExpr neg()
Description copied from interface:JExpr
Negate this expression using the unary-
operator.
-
band
public JExpr band(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary&
operator.
-
bor
public JExpr bor(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary|
operator.
-
bxor
public JExpr bxor(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary^
operator.
-
shr
public JExpr shr(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary>>
operator.
-
lshr
public JExpr lshr(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary>>>
operator.
-
shl
public JExpr shl(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary<<
operator.
-
comp
public JExpr comp()
Description copied from interface:JExpr
Invert this expression using the unary~
operator.
-
and
public JExpr and(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary&&
operator.
-
or
public JExpr or(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary||
operator.
-
not
public JExpr not()
Description copied from interface:JExpr
Invert this expression using the unary!
operator.
-
eq
public JExpr eq(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary==
operator.
-
ne
public JExpr ne(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary!=
operator.
-
lt
public JExpr lt(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary<
operator.
-
gt
public JExpr gt(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary>
operator.
-
le
public JExpr le(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary<=
operator.
-
ge
public JExpr ge(JExpr e1)
Description copied from interface:JExpr
Combine this expression with another using the binary>=
operator.
-
cond
public JExpr cond(JExpr ifTrue, JExpr ifFalse)
Description copied from interface:JExpr
Combine this expression with two others using the ternary? :
operator.
-
paren
public JExpr paren()
Description copied from interface:JExpr
Explicitly wrap this expression in parentheses.
-
_instanceof
public JExpr _instanceof(java.lang.String type)
Description copied from interface:JExpr
Get a type-testing expression using theinstanceof
operator.- Specified by:
_instanceof
in interfaceJExpr
- Parameters:
type
- the type to test- Returns:
- the expression
-
_instanceof
public JExpr _instanceof(JType type)
Description copied from interface:JExpr
Get a type-testing expression using theinstanceof
operator.- Specified by:
_instanceof
in interfaceJExpr
- Parameters:
type
- the type to test- Returns:
- the expression
-
_instanceof
public JExpr _instanceof(java.lang.Class<?> type)
Description copied from interface:JExpr
Get a type-testing expression using theinstanceof
operator.- Specified by:
_instanceof
in interfaceJExpr
- Parameters:
type
- the type to test- Returns:
- the expression
-
cast
public JExpr cast(java.lang.String type)
Description copied from interface:JExpr
Get an expression which is a cast of this expression to the given type.
-
cast
public JExpr cast(JType type)
Description copied from interface:JExpr
Get an expression which is a cast of this expression to the given type.
-
cast
public JExpr cast(java.lang.Class<?> type)
Description copied from interface:JExpr
Get an expression which is a cast of this expression to the given type.
-
call
public JCall call(java.lang.String name)
Description copied from interface:JExpr
Call the given method on this expression.
-
_new
public JCall _new(java.lang.String type)
Description copied from interface:JExpr
Get an expression to construct a new inner class instance of this instance expression.
-
_new
public JCall _new(JType type)
Description copied from interface:JExpr
Get an expression to construct a new inner class instance of this instance expression.
-
_new
public JCall _new(java.lang.Class<?> type)
Description copied from interface:JExpr
Get an expression to construct a new inner class instance of this instance expression.
-
_newAnon
public JAnonymousClassDef _newAnon(java.lang.String type)
Description copied from interface:JExpr
Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
-
_newAnon
public JAnonymousClassDef _newAnon(JType type)
Description copied from interface:JExpr
Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
-
_newAnon
public JAnonymousClassDef _newAnon(java.lang.Class<?> type)
Description copied from interface:JExpr
Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
-
field
public JAssignableExpr field(java.lang.String name)
Description copied from interface:JExpr
Get a field of this object instance.
-
$v
public JAssignableExpr $v(java.lang.String name)
Description copied from interface:JExpr
Get a field of this object instance (shorthand forJExpr.field(String)
.
-
idx
public JAssignableExpr idx(JExpr idx)
Description copied from interface:JExpr
Get an element of this array expression.
-
idx
public JExpr idx(int idx)
Description copied from interface:JExpr
Get an element of this array expression.
-
length
public JExpr length()
Description copied from interface:JExpr
Get thelength
expression of this array expression.
-
prec
public int prec()
-
-