emitController(application.model.processingContext, controller);
}
}
private void emitController(ProcessingContext env, ControllerMetaModel controller) throws ProcessingException {
Name fqn = controller.getHandle().getName();
Element origin = env.get(controller.getHandle());
Collection<HandlerMetaModel> methods = controller.getHandlers();
Writer writer = null;
try {
JavaFileObject file = env.createSourceFile(fqn + "_", origin);
writer = file.openWriter();
//
writer.append("package ").append(fqn.getParent()).append(";\n");
// Imports
writer.append("import ").append(ControllerHandler.class.getCanonicalName()).append(";\n");
writer.append("import ").append(ControlParameter.class.getCanonicalName()).append(";\n");
writer.append("import ").append(PhaseParameter.class.getCanonicalName()).append(";\n");
writer.append("import ").append(ContextualParameter.class.getCanonicalName()).append(";\n");
writer.append("import ").append(BeanParameter.class.getCanonicalName()).append(";\n");
writer.append("import ").append(Tools.class.getCanonicalName()).append(";\n");
writer.append("import ").append(Arrays.class.getCanonicalName()).append(";\n");
writer.append("import ").append(Phase.class.getCanonicalName()).append(";\n");
writer.append("import ").append(ControllerDescriptor.class.getCanonicalName()).append(";\n");
writer.append("import ").append(Generated.class.getCanonicalName()).append(";\n");
writer.append("import ").append(Cardinality.class.getCanonicalName()).append(";\n");
writer.append("import ").append(Request.class.getCanonicalName()).append(";\n");
// Open class
writer.append("@Generated(value={})\n");
writer.append("public class ").append(fqn.getIdentifier()).append("_ {\n");
// Class literal
writer.append("private static final Class<").append(fqn).append("> TYPE = ").append(fqn).append(".class;\n");
//