Package org.jboss.jdeparser
Class JExprs
- java.lang.Object
-
- org.jboss.jdeparser.JExprs
-
public final class JExprs extends java.lang.Object
The factory for generating simple expressions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JAssignableExpr
$v(java.lang.String name)
Return a name expression.static JAssignableExpr
$v(JParamDeclaration paramDeclaration)
Return a name expression from an annotation processor parameter declaration.static JAssignableExpr
$v(JVarDeclaration varDeclaration)
Return a name expression from an annotation processor variable declaration.static JArrayExpr
array()
Return a new array expression.static JArrayExpr
array(int... members)
Return a new array expression.static JArrayExpr
array(long... members)
Return a new array expression.static JArrayExpr
array(java.lang.String... members)
Return a new array expression.static JArrayExpr
array(JExpr... members)
Return a new array expression.static JExpr
binary(int val)
Generate anint
value in binary base.static JExpr
binary(long val)
Generate along
value in binary base.static JCall
call(java.lang.String name)
Generate a method call expression to the given method name.static JCall
call(javax.lang.model.element.ExecutableElement element)
Generate a method call expression to the given element.static JCall
callStatic(java.lang.Class<?> type, java.lang.String name)
Generate a method call expression to a method on the given static type.static JCall
callStatic(java.lang.String type, java.lang.String name)
Generate a method call expression to a method on the given static type.static JCall
callStatic(JType type, java.lang.String name)
Generate a method call expression to a method on the given static type.static JExpr
ch(int val)
Generate achar
value constant.static JExpr
decimal(double val)
Generate adouble
value in decimal base.static JExpr
decimal(float val)
Generate afloat
value in decimal base.static JExpr
decimal(int val)
Generate anint
value in decimal base.static JExpr
decimal(long val)
Generate along
value in decimal base.static JExpr
hex(double val)
Generate adouble
value in hexadecimal base.static JExpr
hex(float val)
Generate afloat
value in hexadecimal base.static JExpr
hex(int val)
Generate anint
value in hexadecimal base.static JExpr
hex(long val)
Generate along
value in hexadecimal base.static JLambda
lambda()
Return a lambda expression.static JAssignableExpr
name(java.lang.String name)
Return a name expression.static JAssignableExpr
name(JParamDeclaration paramDeclaration)
Return a name expression from an annotation processor parameter declaration.static JAssignableExpr
name(JVarDeclaration varDeclaration)
Return a name expression from an annotation processor variable declaration.static JExpr
str(java.lang.String string)
Generate a string constant value.
-
-
-
Method Detail
-
decimal
public static JExpr decimal(int val)
Generate anint
value in decimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
decimal
public static JExpr decimal(long val)
Generate along
value in decimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
decimal
public static JExpr decimal(float val)
Generate afloat
value in decimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
decimal
public static JExpr decimal(double val)
Generate adouble
value in decimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
hex
public static JExpr hex(int val)
Generate anint
value in hexadecimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
hex
public static JExpr hex(long val)
Generate along
value in hexadecimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
hex
public static JExpr hex(float val)
Generate afloat
value in hexadecimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
hex
public static JExpr hex(double val)
Generate adouble
value in hexadecimal base.- Parameters:
val
- the value- Returns:
- the value expression
-
binary
public static JExpr binary(int val)
Generate anint
value in binary base.- Parameters:
val
- the value- Returns:
- the value expression
-
binary
public static JExpr binary(long val)
Generate along
value in binary base.- Parameters:
val
- the value- Returns:
- the value expression
-
str
public static JExpr str(java.lang.String string)
Generate a string constant value.- Parameters:
string
- the string- Returns:
- the string expression
-
ch
public static JExpr ch(int val)
Generate achar
value constant.- Parameters:
val
- the value- Returns:
- the value expression
-
call
public static JCall call(javax.lang.model.element.ExecutableElement element)
Generate a method call expression to the given element.- Parameters:
element
- the method to call- Returns:
- the method call
-
call
public static JCall call(java.lang.String name)
Generate a method call expression to the given method name.- Parameters:
name
- the name of the method to call- Returns:
- the method call
-
callStatic
public static JCall callStatic(java.lang.String type, java.lang.String name)
Generate a method call expression to a method on the given static type.- Parameters:
type
- the type to call againstname
- the name of the method to call- Returns:
- the method call
-
callStatic
public static JCall callStatic(JType type, java.lang.String name)
Generate a method call expression to a method on the given static type.- Parameters:
type
- the type to call againstname
- the name of the method to call- Returns:
- the method call
-
callStatic
public static JCall callStatic(java.lang.Class<?> type, java.lang.String name)
Generate a method call expression to a method on the given static type.- Parameters:
type
- the type to call againstname
- the name of the method to call- Returns:
- the method call
-
$v
public static JAssignableExpr $v(java.lang.String name)
Return a name expression. This method is a shortcut forname(String)
.- Parameters:
name
- the name- Returns:
- the expression
-
$v
public static JAssignableExpr $v(JParamDeclaration paramDeclaration)
Return a name expression from an annotation processor parameter declaration.- Parameters:
paramDeclaration
- the method parameter- Returns:
- the expression
-
$v
public static JAssignableExpr $v(JVarDeclaration varDeclaration)
Return a name expression from an annotation processor variable declaration.- Parameters:
varDeclaration
- the variable declaration- Returns:
- the expression
-
name
public static JAssignableExpr name(java.lang.String name)
Return a name expression.- Parameters:
name
- the name- Returns:
- the expression
-
name
public static JAssignableExpr name(JParamDeclaration paramDeclaration)
Return a name expression from an annotation processor parameter declaration.- Parameters:
paramDeclaration
- the method parameter- Returns:
- the expression
-
name
public static JAssignableExpr name(JVarDeclaration varDeclaration)
Return a name expression from an annotation processor variable declaration.- Parameters:
varDeclaration
- the variable declaration- Returns:
- the expression
-
array
public static JArrayExpr array()
Return a new array expression. The array is initially empty.- Returns:
- an array expression
-
array
public static JArrayExpr array(JExpr... members)
Return a new array expression. The array is initially filled with the given members.- Parameters:
members
- the initial members of the array- Returns:
- an array expression
-
array
public static JArrayExpr array(java.lang.String... members)
Return a new array expression. The array is initially filled with the given strings.- Parameters:
members
- the initial members of the array- Returns:
- an array expression
-
array
public static JArrayExpr array(int... members)
Return a new array expression. The array is initially filled with the given integers.- Parameters:
members
- the initial members of the array- Returns:
- an array expression
-
array
public static JArrayExpr array(long... members)
Return a new array expression. The array is initially filled with the given integers.- Parameters:
members
- the initial members of the array- Returns:
- an array expression
-
lambda
public static JLambda lambda()
Return a lambda expression. The expression is initially empty.- Returns:
- the lambda expression
-
-