public BlockStatement getDefaultBlock() { if (defaultBlock == null) defaultBlock = new BlockStatement(); return defaultBlock; }
public BlockStatement getDefaultBlock() { if (defaultBlock == null) defaultBlock = new BlockStatement(); return defaultBlock; }
protected AbstractConditionalBlock(BooleanExpression condition) { this.condition = condition; this.block = new BlockStatement(); }
public BlockStatement getFinallyBlock() { if (finallyBlock == null) finallyBlock = new BlockStatement(); return finallyBlock; }
public BlockStatement getFinallyBlock() { if (finallyBlock == null) finallyBlock = new BlockStatement(); return finallyBlock; }
protected AbstractConditionalBlock(BooleanExpression condition) { this.condition = condition; this.block = new BlockStatement(); }
public BlockBuilderImpl(final BuildCallback<T> callback) { this(new BlockStatement(), callback); }
public BlockBuilderImpl(final BuildCallback<T> callback) { this(new BlockStatement(), callback); }
public void addCase(LiteralValue<?> value) { caseBlocks.put(value, new BlockStatement()); }
public void addCatchBlock(Variable exception) { catchBlocks.put(exception, new BlockStatement()); }
private Statement generateRequest(ClassStructureBuilder<?> classBuilder, MetaMethod method, Statement methodParams, boolean intercepted) { final Statement sendable = Stmt .invokeStatic(MessageBuilder.class, "createCall") .invoke("call", remote.getFullyQualifiedName()) .invoke("endpoint", ProxyUtil.createCallSignature(method), Stmt.loadClassMember("qualifiers"), methodParams) .invoke("respondTo", method.getReturnType().asBoxed(), Stmt.loadVariable("remoteCallback")) .invoke("errorsHandledBy", Stmt.loadVariable("errorCallback")); final BlockStatement requestBlock = new BlockStatement(); requestBlock.addStatement(Stmt.declareVariable("sendable", RemoteCallSendable.class, sendable)); requestBlock.addStatement(Stmt.loadStatic(classBuilder.getClassDefinition(), "this") .invoke("sendRequest", Variable.get("bus"), Variable.get("sendable"))); return requestBlock; } }
@Override public MetaConstructor[] getConstructors() { if (_constructorsCache != null) return _constructorsCache; if (constructors.isEmpty()) { // add an empty no-arg constructor final BuildMetaConstructor buildMetaConstructor = new BuildMetaConstructor(this, new BlockStatement(), DefParameters.none()); buildMetaConstructor.setScope(Scope.Public); return _constructorsCache = new MetaConstructor[]{buildMetaConstructor}; } else { return _constructorsCache = constructors.toArray(new MetaConstructor[constructors.size()]); } }
@Override public BlockBuilder<StatementEnd> foreach(final String loopVarName, final MetaClass loopVarType) { final BlockStatement body = new BlockStatement(); appendCallElement(foreachCallElement(body, loopVarName, loopVarType, false)); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> foreachIfNotNull(String loopVarName, MetaClass loopVarType) { final BlockStatement body = new BlockStatement(); appendCallElement(foreachCallElement(body, loopVarName, loopVarType, true)); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> foreach(final String loopVarName, final MetaClass loopVarType) { final BlockStatement body = new BlockStatement(); appendCallElement(foreachCallElement(body, loopVarName, loopVarType, false)); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> foreachIfNotNull(String loopVarName, MetaClass loopVarType) { final BlockStatement body = new BlockStatement(); appendCallElement(foreachCallElement(body, loopVarName, loopVarType, true)); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> for_(final Statement initializer, final BooleanExpression condition, final Statement countingExpression) { final BlockStatement body = new BlockStatement(); appendCallElement(new ConditionalBlockCallElement(new ForLoop(condition, body, initializer, countingExpression))); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> while_(final BooleanExpression condition) { final BlockStatement body = new BlockStatement(); appendCallElement(new ConditionalBlockCallElement(new WhileLoop(condition, body))); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> for_(final Statement initializer, final BooleanExpression condition, final Statement countingExpression) { final BlockStatement body = new BlockStatement(); appendCallElement(new ConditionalBlockCallElement(new ForLoop(condition, body, initializer, countingExpression))); return createLoopBody(body); }
@Override public BlockBuilder<StatementEnd> while_(final BooleanExpression condition) { final BlockStatement body = new BlockStatement(); appendCallElement(new ConditionalBlockCallElement(new WhileLoop(condition, body))); return createLoopBody(body); }