Package com.sun.codemodel
Class JExpr
java.lang.Object
com.sun.codemodel.JExpr
Factory methods that generate various
JExpression
s.-
Field Summary
Modifier and TypeFieldDescriptionstatic final JExpression
Boolean constant that representsfalse
static final JExpression
Boolean constant that representstrue
-
Method Summary
Modifier and TypeMethodDescriptionstatic JInvocation
static JInvocation
static JExpression
_null()
static JExpression
_super()
Returns a reference to "super", an implicit reference to the super class.static JExpression
_this()
Returns a reference to "this", an implicit reference to the current object.static JExpression
assign
(JAssignmentTarget lhs, JExpression rhs) static JExpression
assignPlus
(JAssignmentTarget lhs, JExpression rhs) static JCast
cast
(JType type, JExpression expr) static JArrayCompRef
component
(JExpression lhs, JExpression index) static JExpression
Creates an expression directly from a source code fragment.static JExpression
static JInvocation
invoke
(JExpression lhs, JMethod method) static JInvocation
invoke
(JExpression lhs, String method) static JInvocation
static JInvocation
static JExpression
lit
(boolean b) static JExpression
lit
(char c) static JExpression
lit
(double d) static JExpression
lit
(float f) static JExpression
lit
(int n) static JExpression
lit
(long n) static JExpression
static JArray
static JArray
Generatesnew T[size]
.static JArray
newArray
(JType type, JExpression size) Generatesnew T[size]
.static String
Escapes the given string, then surrounds it by the specified quotation mark.static JFieldRef
ref
(JExpression lhs, JVar field) static JFieldRef
ref
(JExpression lhs, String field) static JFieldRef
static JFieldRef
-
Field Details
-
TRUE
Boolean constant that representstrue
-
FALSE
Boolean constant that representsfalse
-
-
Method Details
-
assign
-
assignPlus
-
_new
-
_new
-
invoke
-
invoke
-
invoke
-
invoke
-
ref
-
ref
-
ref
-
refthis
-
dotclass
-
component
-
cast
-
newArray
-
newArray
Generatesnew T[size]
.- Parameters:
type
- The type of the array component. 'T' ornew T[size]
.
-
newArray
Generatesnew T[size]
.- Parameters:
type
- The type of the array component. 'T' ornew T[size]
.
-
_this
Returns a reference to "this", an implicit reference to the current object. -
_super
Returns a reference to "super", an implicit reference to the super class. -
_null
-
lit
-
lit
-
lit
-
lit
-
lit
-
quotify
Escapes the given string, then surrounds it by the specified quotation mark. -
lit
-
lit
-
direct
Creates an expression directly from a source code fragment.This method can be used as a short-cut to create a JExpression. For example, instead of
_a.gt(_b)
, you can write it as:JExpr.direct("a>b")
.Be warned that there is a danger in using this method, as it obfuscates the object model.
-