private CallElement foreachCallElement(final BlockStatement body, final String loopVarName, final MetaClass loopVarType, final boolean nullSafe) { return new DeferredCallElement((writer, context, statement) -> { GenUtil.assertIsIterable(statement); final Variable loopVar = createForEachLoopVar(statement, loopVarName, loopVarType, context); final String collection = writer.getCallString(); writer.reset(); writer.append(new ForeachLoop(loopVar, collection, body, nullSafe).generate(Context.create(context))); }); }
private CallElement foreachCallElement(final BlockStatement body, final String loopVarName, final MetaClass loopVarType, final boolean nullSafe) { return new DeferredCallElement((writer, context, statement) -> { GenUtil.assertIsIterable(statement); final Variable loopVar = createForEachLoopVar(statement, loopVarName, loopVarType, context); final String collection = writer.getCallString(); writer.reset(); writer.append(new ForeachLoop(loopVar, collection, body, nullSafe).generate(Context.create(context))); }); }