private CatchDefinitionRenderer() {
// Utility class, no public or protected default constructor
}
public static void render(StringBuilder buffer, ProcessorDefinition<?> processor) {
CatchDefinition catchDef = (CatchDefinition)processor;
buffer.append(".").append(catchDef.getShortName()).append("(");
List<Class> exceptions = catchDef.getExceptionClasses();
for (Class clazz : exceptions) {
buffer.append(clazz.getSimpleName()).append(".class");
if (clazz != exceptions.get(exceptions.size() - 1)) {
buffer.append(", ");
}
}
buffer.append(")");
// render handled() dsl
if (catchDef.getHandledPolicy() != null) {
String handled = catchDef.getHandledPolicy().toString();
buffer.append(".handled(").append(handled).append(")");
}
List<ProcessorDefinition> branches = catchDef.getOutputs();
for (ProcessorDefinition branch : branches) {
SendDefinitionRenderer.render(buffer, branch);
}
}