use of io.micronaut.context.annotation.ContextConfigurer in project micronaut-core by micronaut-projects.
the class ServiceDescriptionProcessor method processContextConfigurerAnnotation.
private void processContextConfigurerAnnotation(List<io.micronaut.inject.ast.Element> originatingElements, Element element, TypeElement typeElement) {
AnnotationMetadata annotationMetadata = annotationUtils.getAnnotationMetadata(element);
Optional<AnnotationValue<ContextConfigurer>> ann = annotationMetadata.findAnnotation(ContextConfigurer.class);
if (ann.isPresent()) {
JavaClassElement javaClassElement = javaVisitorContext.getElementFactory().newClassElement(typeElement, annotationMetadata);
ContextConfigurerVisitor.assertNoConstructorForContextAnnotation(javaClassElement);
List<? extends TypeMirror> interfaces = typeElement.getInterfaces();
for (TypeMirror interfaceType : interfaces) {
if (interfaceType instanceof DeclaredType) {
String serviceName = modelUtils.resolveTypeName(interfaceType);
String serviceImpl = modelUtils.resolveTypeName(element.asType());
if (SUPPORTED_SERVICE_TYPES.contains(serviceName)) {
serviceDescriptors.computeIfAbsent(serviceName, s1 -> new HashSet<>()).add(serviceImpl);
originatingElements.add(new JavaClassElement(typeElement, AnnotationMetadata.EMPTY_METADATA, null));
}
}
}
}
AnnotationUtils.invalidateCache();
}
Aggregations