TraceSettingAttribute attribute = context.getOperatorDescription().getAttribute(TraceSettingAttribute.class);
if (attribute == null) {
throw new IllegalStateException();
}
Tracepoint tracepoint = attribute.getSetting().getTracepoint();
ModelFactory f = Models.getModelFactory();
List<Expression> arguments = new ArrayList<Expression>();
// serial number
arguments.add(Models.toLiteral(f, attribute.getSerialNumber()));
// operator class
arguments.add(Models.toLiteral(f, tracepoint.getOperatorClassName()));
// operator method
arguments.add(Models.toLiteral(f, tracepoint.getOperatorMethodName()));
// port direction
arguments.add(new TypeBuilder(f, context.convert(PortDirection.class))
.field(tracepoint.getPortKind() == PortKind.INPUT
? PortDirection.INPUT.name() : PortDirection.OUTPUT.name())
.toExpression());
// port name
arguments.add(Models.toLiteral(f, tracepoint.getPortName()));
// data type
arguments.add(f.newClassLiteral(context.convert(context.getInputPort(0).getDataType())));
// attributes
Map<String, String> traceAttributes = new TreeMap<String, String>(attribute.getSetting().getAttributes());
for (Map.Entry<String, String> entry : traceAttributes.entrySet()) {
arguments.add(Models.toLiteral(f, entry.getKey()));