Package org.jboss.jdeparser
Class JExprs
- java.lang.Object
-
- org.jboss.jdeparser.JExprs
-
public final class JExprs extends java.lang.ObjectThe factory for generating simple expressions.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.ThreadLocal<java.util.LinkedHashMap<java.lang.String,JAssignableExpr>>cache
-
Constructor Summary
Constructors Modifier Constructor Description privateJExprs()
-
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 JArrayExprarray()Return a new array expression.static JArrayExprarray(int... members)Return a new array expression.static JArrayExprarray(long... members)Return a new array expression.static JArrayExprarray(java.lang.String... members)Return a new array expression.static JArrayExprarray(JExpr... members)Return a new array expression.static JExprbinary(int val)Generate anintvalue in binary base.static JExprbinary(long val)Generate alongvalue in binary base.static JCallcall(java.lang.String name)Generate a method call expression to the given method name.static JCallcall(javax.lang.model.element.ExecutableElement element)Generate a method call expression to the given element.static JCallcallStatic(java.lang.Class<?> type, java.lang.String name)Generate a method call expression to a method on the given static type.static JCallcallStatic(java.lang.String type, java.lang.String name)Generate a method call expression to a method on the given static type.static JCallcallStatic(JType type, java.lang.String name)Generate a method call expression to a method on the given static type.static JExprch(int val)Generate acharvalue constant.static JExprdecimal(double val)Generate adoublevalue in decimal base.static JExprdecimal(float val)Generate afloatvalue in decimal base.static JExprdecimal(int val)Generate anintvalue in decimal base.static JExprdecimal(long val)Generate alongvalue in decimal base.static JExprhex(double val)Generate adoublevalue in hexadecimal base.static JExprhex(float val)Generate afloatvalue in hexadecimal base.static JExprhex(int val)Generate anintvalue in hexadecimal base.static JExprhex(long val)Generate alongvalue in hexadecimal base.static JLambdalambda()Return a lambda expression.static JAssignableExprname(java.lang.String name)Return a name expression.static JAssignableExprname(JParamDeclaration paramDeclaration)Return a name expression from an annotation processor parameter declaration.static JAssignableExprname(JVarDeclaration varDeclaration)Return a name expression from an annotation processor variable declaration.static JExprstr(java.lang.String string)Generate a string constant value.
-
-
-
Field Detail
-
cache
static final java.lang.ThreadLocal<java.util.LinkedHashMap<java.lang.String,JAssignableExpr>> cache
-
-
Method Detail
-
decimal
public static JExpr decimal(int val)
Generate anintvalue in decimal base.- Parameters:
val- the value- Returns:
- the value expression
-
decimal
public static JExpr decimal(long val)
Generate alongvalue in decimal base.- Parameters:
val- the value- Returns:
- the value expression
-
decimal
public static JExpr decimal(float val)
Generate afloatvalue in decimal base.- Parameters:
val- the value- Returns:
- the value expression
-
decimal
public static JExpr decimal(double val)
Generate adoublevalue in decimal base.- Parameters:
val- the value- Returns:
- the value expression
-
hex
public static JExpr hex(int val)
Generate anintvalue in hexadecimal base.- Parameters:
val- the value- Returns:
- the value expression
-
hex
public static JExpr hex(long val)
Generate alongvalue in hexadecimal base.- Parameters:
val- the value- Returns:
- the value expression
-
hex
public static JExpr hex(float val)
Generate afloatvalue in hexadecimal base.- Parameters:
val- the value- Returns:
- the value expression
-
hex
public static JExpr hex(double val)
Generate adoublevalue in hexadecimal base.- Parameters:
val- the value- Returns:
- the value expression
-
binary
public static JExpr binary(int val)
Generate anintvalue in binary base.- Parameters:
val- the value- Returns:
- the value expression
-
binary
public static JExpr binary(long val)
Generate alongvalue 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 acharvalue 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
-
-