public class ConvertFlowProcessor extends LineEndProcessor {
@Override
public void emitLineEnd(Context context) {
ModelFactory f = context.getModelFactory();
Expression input = context.getInput();
Expression impl = context.createImplementation();
OperatorDescription desc = context.getOperatorDescription();
FlowElementPortDescription converted = context.getOutputPort(Convert.ID_OUTPUT_CONVERTED);
FlowElementPortDescription original = context.getOutputPort(Convert.ID_OUTPUT_ORIGINAL);
List<Expression> arguments = Lists.create();
arguments.add(input);
for (OperatorDescription.Parameter param : desc.getParameters()) {
arguments.add(Models.toLiteral(f, param.getValue()));
}
Expression result = context.createLocalVariable(
converted.getDataType(),
new ExpressionBuilder(f, impl)
.method(desc.getDeclaration().getName(), arguments)
.toExpression());