/** * Convenience method to see if an annotated node is {@code @EventPublisher}. * * @param node the node to check * @return true if the node is an event publisher */ public static boolean hasEventPublisherAnnotation(AnnotatedNode node) { for (AnnotationNode annotation : node.getAnnotations()) { if (EVENT_PUBLISHER_ANODE.equals(annotation.getClassNode())) { return true; } } return false; }
public static void addEventPublisherIfNeeded( SourceUnit source, AnnotationNode annotationNode, ClassNode classNode) { if (needsDelegate(classNode, source, METHODS, "EventPublisher", EVENT_PUBLISHER_TYPE)) { LOG.debug("Injecting {} into {}", EVENT_PUBLISHER_TYPE, classNode.getName()); ConstantExpression value = (ConstantExpression) annotationNode.getMember("value"); String beanName = value != null ? value.getText() : null; beanName = isBlank(beanName) ? null : beanName; apply(classNode, beanName); } }