public interface JBlock extends JStatement, JCommentable
Modifier and Type | Interface and Description |
---|---|
static class |
JBlock.Braces
Braces mode.
|
Modifier and Type | Method and Description |
---|---|
JStatement |
_assert(JExpr expr)
Insert an
assert statement at this point. |
JStatement |
_assert(JExpr expr,
JExpr message)
Insert an
assert statement at this point with a message. |
JStatement |
_break()
Insert a
break statement at this point. |
JStatement |
_break(JLabel label)
Insert a labelled
break statement at this point. |
JClassDef |
_class(int mods,
String name)
Insert a local class definition at this point.
|
JStatement |
_continue()
Insert a
continue statement at this point. |
JStatement |
_continue(JLabel label)
Insert a labelled
continue statement at this point. |
JBlock |
_do(JExpr cond)
Insert a
do /while statement at this point. |
JFor |
_for()
Insert a
for loop at this point. |
JIf |
_if(JExpr cond)
Insert an
if statement at this point. |
JCall |
_new(Class<?> type)
Insert an object construction statement at this point.
|
JCall |
_new(JType type)
Insert an object construction statement at this point.
|
JCall |
_new(String type)
Insert an object construction statement at this point.
|
JAnonymousClassDef |
_newAnon(Class<?> type)
Insert an object construction statement for an anonymous class at this point.
|
JAnonymousClassDef |
_newAnon(JType type)
Insert an object construction statement for an anonymous class at this point.
|
JAnonymousClassDef |
_newAnon(String type)
Insert an object construction statement for an anonymous class at this point.
|
JStatement |
_return()
Insert a
void return statement at this point. |
JStatement |
_return(JExpr expr)
Insert a
return statement at this point. |
JSwitch |
_switch(JExpr expr)
Insert a
switch statement at this point. |
JBlock |
_synchronized(JExpr synchExpr)
Insert a
synchronized block at this point. |
JStatement |
_throw(JExpr expr)
Insert a
throw statement at this point. |
JTry |
_try()
Insert a
try block at this point. |
JBlock |
_while(JExpr cond)
Insert a
while statement at this point. |
JStatement |
add(JExpr expr)
Insert an expression statement at this point.
|
JStatement |
addAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
+= ) expression at this point. |
JStatement |
andAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
&= ) expression at this point. |
JLabel |
anonLabel()
Add a label at this point whose unique name is automatically generated.
|
JLabel |
anonLabel(JLabel label)
Name and attach a forward label as anonymous.
|
JStatement |
assign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
= ) expression at this point. |
JBlock |
blankLine()
Insert a blank line at this point.
|
JBlock |
block(JBlock.Braces braces)
Create a nested sub-block at this point.
|
JCall |
call(ExecutableElement element)
Insert a method invocation at this point.
|
JCall |
call(JExpr obj,
ExecutableElement element)
Insert a method invocation at this point.
|
JCall |
call(JExpr obj,
String name)
Insert a method invocation at this point.
|
JCall |
call(String name)
Insert a method invocation at this point.
|
JCall |
callStatic(Class<?> type,
String name)
Insert a type-qualified static method invocation at this point.
|
JCall |
callStatic(ExecutableElement element)
Insert a type-qualified static method invocation at this point.
|
JCall |
callStatic(JType type,
String name)
Insert a type-qualified static method invocation at this point.
|
JCall |
callStatic(String type,
String name)
Insert a type-qualified static method invocation at this point.
|
JCall |
callSuper()
Insert a
super() call at this point. |
JCall |
callThis()
Insert a
this() call at this point. |
JStatement |
divAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
/= ) expression at this point. |
JStatement |
empty()
Insert an empty statement at this point (just a semicolon).
|
JBlock |
forEach(int mods,
Class<?> type,
String name,
JExpr iterable)
Insert a "for-each" style
for loop at this point. |
JBlock |
forEach(int mods,
JType type,
String name,
JExpr iterable)
Insert a "for-each" style
for loop at this point. |
JBlock |
forEach(int mods,
String type,
String name,
JExpr iterable)
Insert a "for-each" style
for loop at this point. |
JLabel |
forwardLabel()
Create a forward label that can be named and attached later.
|
JLabel |
label(JLabel label,
String name)
Name and attach a forward label.
|
JLabel |
label(String name)
Add a label at this point, which may be used for future branch instructions.
|
JStatement |
lshrAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
>>>= ) expression at this point. |
JStatement |
modAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
%= ) expression at this point. |
JStatement |
mulAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
*= ) expression at this point. |
JStatement |
orAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
|= ) expression at this point. |
JStatement |
postDec(JAssignableExpr target)
Insert a postfix
-- expression at this point. |
JStatement |
postInc(JAssignableExpr target)
Insert a postfix
++ expression at this point. |
JStatement |
preDec(JAssignableExpr target)
Insert a prefix
-- expression at this point. |
JStatement |
preInc(JAssignableExpr target)
Insert a prefix
++ expression at this point. |
JStatement |
shlAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
<<= ) expression at this point. |
JStatement |
shrAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
>>= ) expression at this point. |
JStatement |
subAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
-= ) expression at this point. |
String |
tempName()
Generate a temporary variable name.
|
JExpr |
tempVar(Class<?> type,
JExpr value)
Insert a local variable declaration at this point with a generated name.
|
JExpr |
tempVar(JType type,
JExpr value)
Insert a local variable declaration at this point with a generated name.
|
JExpr |
tempVar(String type,
JExpr value)
Insert a local variable declaration at this point with a generated name.
|
JVarDeclaration |
var(int mods,
Class<?> type,
String name)
Insert a local variable declaration at this point.
|
JVarDeclaration |
var(int mods,
Class<?> type,
String name,
JExpr value)
Insert a local variable declaration at this point.
|
JVarDeclaration |
var(int mods,
JType type,
String name)
Insert a local variable declaration at this point.
|
JVarDeclaration |
var(int mods,
JType type,
String name,
JExpr value)
Insert a local variable declaration at this point.
|
JVarDeclaration |
var(int mods,
String type,
String name)
Insert a local variable declaration at this point.
|
JVarDeclaration |
var(int mods,
String type,
String name,
JExpr value)
Insert a local variable declaration at this point.
|
JStatement |
xorAssign(JAssignableExpr target,
JExpr e1)
Insert an assignment (
^= ) expression at this point. |
blockComment, lineComment
JBlock blankLine()
JBlock block(JBlock.Braces braces)
braces
- the rule for adding bracesJIf _if(JExpr cond)
if
statement at this point.cond
- the if
conditionif
statementJBlock _while(JExpr cond)
while
statement at this point.cond
- the while
conditionwhile
statementJBlock _do(JExpr cond)
do
/while
statement at this point.cond
- the while
conditionwhile
statementJLabel label(String name)
name
- the label nameJLabel anonLabel()
JLabel forwardLabel()
JLabel label(JLabel label, String name)
label
- the label to name and attachname
- the label nameJLabel anonLabel(JLabel label)
label
- the label to name and attachJStatement _continue()
continue
statement at this point.JStatement _continue(JLabel label)
continue
statement at this point.label
- the labelJStatement _break()
break
statement at this point.JStatement _break(JLabel label)
break
statement at this point.label
- the labelJBlock forEach(int mods, String type, String name, JExpr iterable)
for
loop at this point.mods
- the item variable modifierstype
- the item variable typename
- the item variable nameiterable
- the iterable or array expressionfor
loopJBlock forEach(int mods, JType type, String name, JExpr iterable)
for
loop at this point.mods
- the item variable modifierstype
- the item variable typename
- the item variable nameiterable
- the iterable or array expressionfor
loopJBlock forEach(int mods, Class<?> type, String name, JExpr iterable)
for
loop at this point.mods
- the item variable modifierstype
- the item variable typename
- the item variable nameiterable
- the iterable or array expressionfor
loopJFor _for()
for
loop at this point.for
loopJSwitch _switch(JExpr expr)
switch
statement at this point.expr
- the switch
expressionswitch
statementJStatement _return(JExpr expr)
return
statement at this point.expr
- the expression to returnJStatement _return()
void
return
statement at this point.JStatement _assert(JExpr expr)
assert
statement at this point.expr
- the expression to assertJStatement _assert(JExpr expr, JExpr message)
assert
statement at this point with a message.expr
- the expression to assertmessage
- the assertion messageJCall callThis()
this()
call at this point.JCall callSuper()
super()
call at this point.JStatement add(JExpr expr)
expr
- the expression to addJCall call(ExecutableElement element)
block.call(element);
block.add(JExprs.call(element));
element
- the program element whose name to useJCall call(JExpr obj, ExecutableElement element)
obj
- the expression upon which to invokeelement
- the program element whose name to useJCall call(String name)
block.call(methodName);
block.add(JExprs.call(methodName));
name
- the method nameJCall call(JExpr obj, String name)
obj
- the expression upon which to invokename
- the method nameJCall callStatic(ExecutableElement element)
element
- the program element whose name and type to useJCall callStatic(String type, String name)
type
- the type upon which to invokename
- the method nameJCall callStatic(JType type, String name)
type
- the type upon which to invokename
- the method nameJCall callStatic(Class<?> type, String name)
type
- the type upon which to invokename
- the method nameJCall _new(String type)
type
- the type to instantiateJCall _new(JType type)
type
- the type to instantiateJCall _new(Class<?> type)
type
- the type to instantiateJAnonymousClassDef _newAnon(String type)
type
- the type to instantiateJAnonymousClassDef _newAnon(JType type)
type
- the type to instantiateJAnonymousClassDef _newAnon(Class<?> type)
type
- the type to instantiateJClassDef _class(int mods, String name)
mods
- the class modifiersname
- the local class nameJBlock _synchronized(JExpr synchExpr)
synchronized
block at this point.synchExpr
- the lock expressionsynchronized
blockJStatement assign(JAssignableExpr target, JExpr e1)
=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement addAssign(JAssignableExpr target, JExpr e1)
+=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement subAssign(JAssignableExpr target, JExpr e1)
-=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement mulAssign(JAssignableExpr target, JExpr e1)
*=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement divAssign(JAssignableExpr target, JExpr e1)
/=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement modAssign(JAssignableExpr target, JExpr e1)
%=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement andAssign(JAssignableExpr target, JExpr e1)
&=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement orAssign(JAssignableExpr target, JExpr e1)
|=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement xorAssign(JAssignableExpr target, JExpr e1)
^=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement shrAssign(JAssignableExpr target, JExpr e1)
>>=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement lshrAssign(JAssignableExpr target, JExpr e1)
>>>=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement shlAssign(JAssignableExpr target, JExpr e1)
<<=
) expression at this point.target
- the assignment targete1
- the expression to applyJStatement postInc(JAssignableExpr target)
++
expression at this point.target
- the target expressionJStatement postDec(JAssignableExpr target)
--
expression at this point.target
- the target expressionJStatement preInc(JAssignableExpr target)
++
expression at this point.target
- the target expressionJStatement preDec(JAssignableExpr target)
--
expression at this point.target
- the target expressionJStatement empty()
JStatement _throw(JExpr expr)
throw
statement at this point.expr
- the expression to throwJTry _try()
try
block at this point.try
blockJVarDeclaration var(int mods, String type, String name, JExpr value)
mods
- the variable modifierstype
- the local variable typename
- the local variable namevalue
- the local variable's initializer expressionJVarDeclaration var(int mods, JType type, String name, JExpr value)
mods
- the variable modifierstype
- the local variable typename
- the local variable namevalue
- the local variable's initializer expressionJVarDeclaration var(int mods, Class<?> type, String name, JExpr value)
mods
- the variable modifierstype
- the local variable typename
- the local variable namevalue
- the local variable's initializer expressionJVarDeclaration var(int mods, String type, String name)
mods
- the variable modifierstype
- the local variable typename
- the local variable nameJVarDeclaration var(int mods, JType type, String name)
mods
- the variable modifierstype
- the local variable typename
- the local variable nameJVarDeclaration var(int mods, Class<?> type, String name)
mods
- the variable modifierstype
- the local variable typename
- the local variable nameJExpr tempVar(String type, JExpr value)
type
- the local variable typevalue
- the local variable's initializer expressionJExpr tempVar(JType type, JExpr value)
type
- the local variable typevalue
- the local variable's initializer expressionJExpr tempVar(Class<?> type, JExpr value)
type
- the local variable typevalue
- the local variable's initializer expressionString tempName()
Copyright © 2019 JBoss by Red Hat. All rights reserved.