public abstract class JExpr extends Object
JExpression
s.Modifier and Type | Field and Description |
---|---|
static JExpression |
FALSE
Boolean constant that represents
false |
static JExpression |
TRUE
Boolean constant that represents
true |
Modifier and Type | Method and Description |
---|---|
static JInvocation |
_new(JClass c) |
static JInvocation |
_new(JType t) |
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 com.sun.codemodel.JCast |
cast(JType type,
JExpression expr) |
static com.sun.codemodel.JArrayCompRef |
component(JExpression lhs,
JExpression index) |
static JExpression |
direct(String source)
Creates an expression directly from a source code fragment.
|
static JExpression |
dotclass(JClass cl) |
static JInvocation |
invoke(JExpression lhs,
JMethod method) |
static JInvocation |
invoke(JExpression lhs,
String method) |
static JInvocation |
invoke(JMethod method) |
static JInvocation |
invoke(String method) |
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 |
lit(String s) |
static JArray |
newArray(JType type) |
static JArray |
newArray(JType type,
int size)
Generates
new T[size] . |
static JArray |
newArray(JType type,
JExpression size)
Generates
new T[size] . |
static String |
quotify(char quote,
String s)
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 |
ref(String field) |
static JFieldRef |
refthis(String field) |
public static final JExpression TRUE
true
public static final JExpression FALSE
false
public static JExpression assign(JAssignmentTarget lhs, JExpression rhs)
public static JExpression assignPlus(JAssignmentTarget lhs, JExpression rhs)
public static JInvocation _new(JClass c)
public static JInvocation _new(JType t)
public static JInvocation invoke(String method)
public static JInvocation invoke(JMethod method)
public static JInvocation invoke(JExpression lhs, JMethod method)
public static JInvocation invoke(JExpression lhs, String method)
public static JFieldRef ref(JExpression lhs, JVar field)
public static JFieldRef ref(JExpression lhs, String field)
public static JExpression dotclass(JClass cl)
public static com.sun.codemodel.JArrayCompRef component(JExpression lhs, JExpression index)
public static com.sun.codemodel.JCast cast(JType type, JExpression expr)
public static JArray newArray(JType type, JExpression size)
new T[size]
.type
- The type of the array component. 'T' or new T[size]
.public static JArray newArray(JType type, int size)
new T[size]
.type
- The type of the array component. 'T' or new T[size]
.public static JExpression _this()
public static JExpression _super()
public static JExpression _null()
public static JExpression lit(boolean b)
public static JExpression lit(int n)
public static JExpression lit(long n)
public static JExpression lit(float f)
public static JExpression lit(double d)
public static String quotify(char quote, String s)
public static JExpression lit(char c)
public static JExpression lit(String s)
public static JExpression direct(String source)
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.
Copyright © 2019 JBoss by Red Hat. All rights reserved.