Interface JBlock
- All Superinterfaces:
JCommentable, JStatement
- All Known Implementing Classes:
BasicJBlock, CaseJBlock, ConditionJBlock, DefaultJBlock, DoJBlock, ElseJBlock, FinallyJBlock, ForEachJBlock, ForJBlock, ImplJCatch, ImplJIf, ImplJTry, InitJBlock, StaticInitJBlock, SynchJBlock, WhileJBlock
A block of code, to which statements may be added.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionInsert anassertstatement at this point.Insert anassertstatement at this point with a message._break()Insert abreakstatement at this point.Insert a labelledbreakstatement at this point.Insert a local class definition at this point.Insert acontinuestatement at this point.Insert a labelledcontinuestatement at this point.Insert ado/whilestatement at this point._for()Insert aforloop at this point.Insert anifstatement at this point.Insert an object construction statement at this point.Insert an object construction statement at this point.Insert an object construction statement at this point.Insert an object construction statement for an anonymous class at this point.Insert an object construction statement for an anonymous class at this point.Insert an object construction statement for an anonymous class at this point._return()Insert avoidreturnstatement at this point.Insert areturnstatement at this point.Insert aswitchstatement at this point._synchronized(JExpr synchExpr) Insert asynchronizedblock at this point.Insert athrowstatement at this point._try()Insert atryblock at this point.Insert awhilestatement at this point.Insert an expression statement at this point.addAssign(JAssignableExpr target, JExpr e1) Insert an assignment (+=) expression at this point.andAssign(JAssignableExpr target, JExpr e1) Insert an assignment (&=) expression at this point.Add a label at this point whose unique name is automatically generated.Name and attach a forward label as anonymous.assign(JAssignableExpr target, JExpr e1) Insert an assignment (=) expression at this point.Insert a blank line at this point.block(JBlock.Braces braces) Create a nested sub-block at this point.Insert a method invocation at this point.call(ExecutableElement element) Insert a method invocation at this point.Insert a method invocation at this point.call(JExpr obj, ExecutableElement element) Insert a method invocation at this point.callStatic(Class<?> type, String name) Insert a type-qualified static method invocation at this point.callStatic(String type, String name) Insert a type-qualified static method invocation at this point.callStatic(ExecutableElement element) Insert a type-qualified static method invocation at this point.callStatic(JType type, String name) Insert a type-qualified static method invocation at this point.Insert asuper()call at this point.callThis()Insert athis()call at this point.divAssign(JAssignableExpr target, JExpr e1) Insert an assignment (/=) expression at this point.empty()Insert an empty statement at this point (just a semicolon).Insert a "for-each" styleforloop at this point.Insert a "for-each" styleforloop at this point.Insert a "for-each" styleforloop at this point.Create a forward label that can be named and attached later.Add a label at this point, which may be used for future branch instructions.Name and attach a forward label.lshrAssign(JAssignableExpr target, JExpr e1) Insert an assignment (>>>=) expression at this point.modAssign(JAssignableExpr target, JExpr e1) Insert an assignment (%=) expression at this point.mulAssign(JAssignableExpr target, JExpr e1) Insert an assignment (*=) expression at this point.orAssign(JAssignableExpr target, JExpr e1) Insert an assignment (|=) expression at this point.postDec(JAssignableExpr target) Insert a postfix--expression at this point.postInc(JAssignableExpr target) Insert a postfix++expression at this point.preDec(JAssignableExpr target) Insert a prefix--expression at this point.preInc(JAssignableExpr target) Insert a prefix++expression at this point.shlAssign(JAssignableExpr target, JExpr e1) Insert an assignment (<<=) expression at this point.shrAssign(JAssignableExpr target, JExpr e1) Insert an assignment (>>=) expression at this point.subAssign(JAssignableExpr target, JExpr e1) Insert an assignment (-=) expression at this point.tempName()Generate a temporary variable name.Insert a local variable declaration at this point with a generated name.Insert a local variable declaration at this point with a generated name.Insert a local variable declaration at this point with a generated name.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.xorAssign(JAssignableExpr target, JExpr e1) Insert an assignment (^=) expression at this point.Methods inherited from interface JCommentable
blockComment, lineComment
-
Method Details
-
blankLine
-
block
Create a nested sub-block at this point.- Parameters:
braces- the rule for adding braces- Returns:
- the nested block
-
_if
-
_while
-
_do
-
label
-
anonLabel
JLabel anonLabel()Add a label at this point whose unique name is automatically generated.- Returns:
- the label
-
forwardLabel
JLabel forwardLabel()Create a forward label that can be named and attached later.- Returns:
- the forward label
-
label
-
anonLabel
-
_continue
-
_continue
Insert a labelledcontinuestatement at this point.- Parameters:
label- the label- Returns:
- the statement
-
_break
-
_break
Insert a labelledbreakstatement at this point.- Parameters:
label- the label- Returns:
- the statement
-
forEach
Insert a "for-each" styleforloop at this point.- Parameters:
mods- the item variable modifierstype- the item variable typename- the item variable nameiterable- the iterable or array expression- Returns:
- the body of the
forloop
-
forEach
Insert a "for-each" styleforloop at this point.- Parameters:
mods- the item variable modifierstype- the item variable typename- the item variable nameiterable- the iterable or array expression- Returns:
- the body of the
forloop
-
forEach
Insert a "for-each" styleforloop at this point.- Parameters:
mods- the item variable modifierstype- the item variable typename- the item variable nameiterable- the iterable or array expression- Returns:
- the body of the
forloop
-
_for
-
_switch
-
_return
Insert areturnstatement at this point.- Parameters:
expr- the expression to return- Returns:
- the statement
-
_return
-
_assert
Insert anassertstatement at this point.- Parameters:
expr- the expression to assert- Returns:
- the statement
-
_assert
Insert anassertstatement at this point with a message.- Parameters:
expr- the expression to assertmessage- the assertion message- Returns:
- the statement
-
callThis
-
callSuper
-
add
Insert an expression statement at this point. Expressions which are invalid statements may generate an error at the time this method is called, or at compile time.- Parameters:
expr- the expression to add- Returns:
- the statement
-
call
Insert a method invocation at this point. Note that these two invocations are identical:block.call(element); block.add(JExprs.call(element));- Parameters:
element- the program element whose name to use- Returns:
- the method call
-
call
Insert a method invocation at this point.- Parameters:
obj- the expression upon which to invokeelement- the program element whose name to use- Returns:
- the method call
-
call
-
call
-
callStatic
Insert a type-qualified static method invocation at this point.- Parameters:
element- the program element whose name and type to use- Returns:
- the method call
-
callStatic
-
callStatic
-
callStatic
-
_new
-
_new
-
_new
-
_newAnon
Insert an object construction statement for an anonymous class at this point.- Parameters:
type- the type to instantiate- Returns:
- the anonymous class definition
-
_newAnon
Insert an object construction statement for an anonymous class at this point.- Parameters:
type- the type to instantiate- Returns:
- the anonymous class definition
-
_newAnon
Insert an object construction statement for an anonymous class at this point.- Parameters:
type- the type to instantiate- Returns:
- the anonymous class definition
-
_class
-
_synchronized
-
assign
Insert an assignment (=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
addAssign
Insert an assignment (+=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
subAssign
Insert an assignment (-=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
mulAssign
Insert an assignment (*=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
divAssign
Insert an assignment (/=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
modAssign
Insert an assignment (%=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
andAssign
Insert an assignment (&=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
orAssign
Insert an assignment (|=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
xorAssign
Insert an assignment (^=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
shrAssign
Insert an assignment (>>=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
lshrAssign
Insert an assignment (>>>=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
shlAssign
Insert an assignment (<<=) expression at this point.- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
postInc
Insert a postfix++expression at this point.- Parameters:
target- the target expression- Returns:
- the statement
-
postDec
Insert a postfix--expression at this point.- Parameters:
target- the target expression- Returns:
- the statement
-
preInc
Insert a prefix++expression at this point.- Parameters:
target- the target expression- Returns:
- the statement
-
preDec
Insert a prefix--expression at this point.- Parameters:
target- the target expression- Returns:
- the statement
-
empty
JStatement empty()Insert an empty statement at this point (just a semicolon).- Returns:
- the statement
-
_throw
Insert athrowstatement at this point.- Parameters:
expr- the expression to throw- Returns:
- the statement
-
_try
-
var
Insert a local variable declaration at this point.- Parameters:
mods- the variable modifierstype- the local variable typename- the local variable namevalue- the local variable's initializer expression- Returns:
- the local variable declaration
-
var
Insert a local variable declaration at this point.- Parameters:
mods- the variable modifierstype- the local variable typename- the local variable namevalue- the local variable's initializer expression- Returns:
- the local variable declaration
-
var
Insert a local variable declaration at this point.- Parameters:
mods- the variable modifierstype- the local variable typename- the local variable namevalue- the local variable's initializer expression- Returns:
- the local variable declaration
-
var
Insert a local variable declaration at this point.- Parameters:
mods- the variable modifierstype- the local variable typename- the local variable name- Returns:
- the local variable declaration
-
var
Insert a local variable declaration at this point.- Parameters:
mods- the variable modifierstype- the local variable typename- the local variable name- Returns:
- the local variable declaration
-
var
Insert a local variable declaration at this point.- Parameters:
mods- the variable modifierstype- the local variable typename- the local variable name- Returns:
- the local variable declaration
-
tempVar
-
tempVar
-
tempVar
-
tempName
-