private static void addEvents(CompilationUnitModel compilationUnitModel, List<Event> events) {
for (Event event : events) {
ClassModel classModel = compilationUnitModel.getClassModel();
String eventTypeQName = generateEventClass(compilationUnitModel, event);
AnnotationModel annotationModel = new AnnotationModel("Event",
new AnnotationPropertyModel("name", "'" + event.name + "'"),
new AnnotationPropertyModel("type", "'" + eventTypeQName + "'"));
annotationModel.setAsdoc(toAsDoc(event.doc) + String.format("\n * @eventType %s.NAME", eventTypeQName));
classModel.addAnnotation(annotationModel);
System.err.println("*** adding event " + event.name + " to class " + classModel.getName());
}
}