use of io.micronaut.annotation.processing.visitor.JavaClassElement in project micronaut-core by micronaut-projects.
the class ServiceDescriptionProcessor method processGeneratedAnnotation.
private boolean processGeneratedAnnotation(List<io.micronaut.inject.ast.Element> originatingElements, Element element, TypeElement typeElement, String name) {
Generated generated = element.getAnnotation(Generated.class);
if (generated != null) {
String serviceName = generated.service();
if (StringUtils.isNotEmpty(serviceName)) {
serviceDescriptors.computeIfAbsent(serviceName, s1 -> new HashSet<>()).add(name);
originatingElements.add(new JavaClassElement(typeElement, AnnotationMetadata.EMPTY_METADATA, null));
}
return true;
}
return false;
}
use of io.micronaut.annotation.processing.visitor.JavaClassElement 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