content
Declarations and statements contained in this block.
Either
JStatement or JDeclaration.JGenerable, JStatement
JBlock contains a large number of factory methods that creates new
statements/declarations. Those newly created statements/declarations are
inserted into the "current position". The position advances
one every time you add a new instruction.
private booleanprivate booleanprivate intvoid_break()voidvoidvoid_do(JExpression test) _for()_if(JExpression expr) void_return()void_return(JExpression exp) _switch(JExpression test) void_throw(JExpression exp) _try()_while(JExpression test) add(JStatement s) assign(JAssignmentTarget lhs,
JExpression exp) assignPlus(JAssignmentTarget lhs,
JExpression exp) block()decl(int mods,
JType type,
String name,
JExpression init) decl(JType type,
String name,
JExpression init) directStatement(String source) forEach(JType varType,
String name,
JExpression collection) void(package private) voidJStatements and JDeclaration
in this block.private <T> Tinsert(T statementOrDeclaration) invoke(JExpression expr,
JMethod method) invoke(JExpression expr,
String method) booleanisEmpty()continue and break statements.intpos()intpos(int newPos) voidstate(JFormatter f) staticInvoke(JClass type,
String method) JStatement or JDeclaration.JStatements and JDeclaration
in this block.IllegalArgumentException - if the new position value is illegal.type - JType of the variablename - Name of the variableinit - Initialization expression for this variable. May be null.mods - Modifiers for the variabletype - JType of the variablename - Name of the variableinit - Initialization expression for this variable. May be null.lhs - Assignable variable or field for left hand side of expressionexp - Right hand side expressionexpr - JExpression evaluating to the class or object upon which
the named method will be invokedmethod - Name of method to invokeexpr - JExpression evaluating to the class or object upon which
the method will be invokedmethod - JMethod to invokemethod - Name of method to invokemethod - JMethod to invokes - JStatement to be addedexpr - JExpression to be tested to determine branchingSpecified string is printed as-is. This is useful as a short-cut.
For example, you can invoke this method as:
directStatement("a=b+c;").
generate in interface JGenerablestate in interface JStatement