name));
arguments[var.getParameterPosition()] = name;
}
for (OperatorPortDeclaration var : flowClass.getOutputPorts()) {
SimpleName name = names.create(var.getName());
Expression type = toExpression(var);
assert type != null;
statements.add(new ExpressionBuilder(factory, builderName)
.method("addOutput", util.v(var.getName()), type)
.toLocalVariableDeclaration(
util.toOutType(var.getType().getRepresentation()),
name));
arguments[var.getParameterPosition()] = name;
}
for (OperatorPortDeclaration var : flowClass.getParameters()) {
Expression type = toExpression(var);
SimpleName name = factory.newSimpleName(var.getName());
statements.add(new ExpressionBuilder(factory, builderName)
.method("addParameter",
util.v(var.getName()),
type,
name)
.toStatement());
arguments[var.getParameterPosition()] = name;
}
SimpleName descName = names.create("desc");
statements.add(new TypeBuilder(factory, getType(util.t(flowClass.getElement())))
.newObject(arguments)
.toLocalVariableDeclaration(util.t(FlowDescription.class), descName));
Expression resolver = new ExpressionBuilder(factory, factory.newThis())
.field(RESOLVER_FIELD_NAME)
.toExpression();
statements.add(new ExpressionBuilder(factory, resolver)
.assignFrom(new ExpressionBuilder(factory, builderName)
.method("toResolver", descName)