use of io.micronaut.annotation.processing.AnnotationUtils in project micronaut-core by micronaut-projects.
the class JavaClassElement method getDefaultConstructor.
@Override
public Optional<MethodElement> getDefaultConstructor() {
final AnnotationUtils annotationUtils = visitorContext.getAnnotationUtils();
final ModelUtils modelUtils = visitorContext.getModelUtils();
ExecutableElement method = modelUtils.defaultStaticCreatorFor(classElement, annotationUtils);
if (method == null) {
if (isInner() && !isStatic()) {
// only static inner classes can be constructed
return Optional.empty();
}
method = modelUtils.defaultConstructorFor(classElement);
}
return createMethodElement(annotationUtils, method);
}
use of io.micronaut.annotation.processing.AnnotationUtils in project micronaut-core by micronaut-projects.
the class JavaClassElement method getPrimaryConstructor.
@NonNull
@Override
public Optional<MethodElement> getPrimaryConstructor() {
final AnnotationUtils annotationUtils = visitorContext.getAnnotationUtils();
final ModelUtils modelUtils = visitorContext.getModelUtils();
ExecutableElement method = modelUtils.staticCreatorFor(classElement, annotationUtils);
if (method == null) {
if (isInner() && !isStatic()) {
// only static inner classes can be constructed
return Optional.empty();
}
method = modelUtils.concreteConstructorFor(classElement, annotationUtils);
}
return createMethodElement(annotationUtils, method);
}
use of io.micronaut.annotation.processing.AnnotationUtils in project micronaut-core by micronaut-projects.
the class AbstractJavaElement method annotate.
@Override
public <T extends Annotation> io.micronaut.inject.ast.Element annotate(AnnotationValue<T> annotationValue) {
ArgumentUtils.requireNonNull("annotationValue", annotationValue);
AnnotationUtils annotationUtils = visitorContext.getAnnotationUtils();
this.annotationMetadata = annotationUtils.newAnnotationBuilder().annotate(annotationMetadata, annotationValue);
updateMetadataCaches();
return this;
}
use of io.micronaut.annotation.processing.AnnotationUtils in project micronaut-core by micronaut-projects.
the class JavaBeanDefinitionBuilder method removeStereotype.
@Override
protected void removeStereotype(AnnotationMetadata annotationMetadata, String annotationType) {
ArgumentUtils.requireNonNull("annotationType", annotationType);
AnnotationUtils annotationUtils = javaVisitorContext.getAnnotationUtils();
annotationUtils.newAnnotationBuilder().removeStereotype(annotationMetadata, annotationType);
}
use of io.micronaut.annotation.processing.AnnotationUtils in project micronaut-core by micronaut-projects.
the class AbstractJavaElement method removeStereotype.
@Override
public io.micronaut.inject.ast.Element removeStereotype(@NonNull String annotationType) {
ArgumentUtils.requireNonNull("annotationType", annotationType);
try {
AnnotationUtils annotationUtils = visitorContext.getAnnotationUtils();
this.annotationMetadata = annotationUtils.newAnnotationBuilder().removeStereotype(annotationMetadata, annotationType);
return this;
} finally {
updateMetadataCaches();
}
}
Aggregations