@Override protected AnnotationValueBuilder<? extends Annotation> buildAnnotation() { return AnnotationValue.builder(CacheInvalidate.class); } }
@Override protected AnnotationValueBuilder<? extends Annotation> buildAnnotation() { return AnnotationValue.builder(CachePut.class); } }
@Override protected AnnotationValueBuilder<?> newBuilder(HttpMethod httpMethod, AnnotationValue<Annotation> annotation) { return AnnotationValue.builder(Put.class); }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { return Collections.singletonList( AnnotationValue.builder(Primary.class).build() ); } }
@Override public List<AnnotationValue<?>> map(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { return Collections.singletonList( AnnotationValue.builder("io.micronaut.management.endpoint.annotation.Selector").build() ); } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { List<AnnotationValue<?>> mappedAnnotations = new ArrayList<>(2); mappedAnnotations.add(AnnotationValue.builder(Factory.class) .build()); mappedAnnotations.add(AnnotationValue.builder( "io.micronaut.spring.context.aop.SpringConfigurationAdvice" ).build()); return mappedAnnotations; } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { return Collections.singletonList( AnnotationValue.builder(Validated.class).build() ); } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { return Collections.singletonList( AnnotationValue.builder("io.micronaut.runtime.event.annotation.EventListener") .build() ); } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final boolean lazy = annotation.getValue(Boolean.class).orElse(true); if (!lazy) { return Collections.singletonList( AnnotationValue.builder(Context.class).build() ); } return Collections.emptyList(); } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final boolean required = annotation.getValue(Boolean.class).orElse(true); List<AnnotationValue<?>> annotations = new ArrayList<>(2); annotations.add(AnnotationValue.builder(Inject.class).build()); if (!required) { annotations.add(AnnotationValue.builder(Nullable.class).build()); } return annotations; } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final List<AnnotationValue<?>> annotationValues = super.mapInternal(annotation, visitorContext); annotationValues.add(AnnotationValue.builder(Controller.class).build()); annotationValues.add(AnnotationValue.builder(Validated.class).build()); return annotationValues; } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final Optional<String> beanName = annotation.getValue(String.class); List<AnnotationValue<?>> mappedAnnotations = new ArrayList<>(2); mappedAnnotations.add(AnnotationValue.builder(Bean.class).build()); mappedAnnotations.add(AnnotationValue.builder(DefaultScope.class) .value(Singleton.class) .build()); beanName.ifPresent(s -> mappedAnnotations.add(AnnotationValue.builder(Named.class).value(s).build())); return mappedAnnotations; } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final AnnotationValueBuilder<Async> builder = AnnotationValue.builder(Async.class); annotation.getValue(String.class).ifPresent(builder::value); return Collections.singletonList(builder.build()); } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { Optional<String[]> value = annotation.getValue(String[].class); return value.<List<AnnotationValue<?>>>map(strings -> Collections.singletonList( AnnotationValue.builder(Requires.class) .member("env", strings).build() )).orElse(Collections.emptyList()); }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final Optional<String> value = annotation.getValue(String.class); if (value.isPresent()) { return Collections.singletonList( AnnotationValue.builder(Value.class) .value(value.get()) .build() ); } return Collections.emptyList(); } }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final String[] produces = annotation.get("produces", String[].class).orElse(null); final AnnotationValue<?> readOp = AnnotationValue.builder("io.micronaut.management.endpoint.annotation." + operationName()).build(); List<AnnotationValue<?>> annotationValues = new ArrayList<>(2); annotationValues.add(readOp); if (produces != null) { final AnnotationValue<Produces> producesAnn = AnnotationValue.builder(Produces.class).member("value", produces).build(); annotationValues.add(producesAnn); } return annotationValues; }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final AnnotationValueBuilder<Error> builder = AnnotationValue.builder(Error.class); annotation.getValue(AnnotationClassValue.class).ifPresent(annotationClassValue -> builder.member("value", annotationClassValue)); return Collections.singletonList( builder .build() ); }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { return Collections.singletonList( AnnotationValue.builder(Requires.class) .member("missingBeans", new AnnotationClassValue<>(EmbeddedServer.class)) .build() ); }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { return Collections.singletonList( AnnotationValue.builder(Requires.class) .member("beans", new AnnotationClassValue<>(EmbeddedServer.class)) .build() ); }
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final Optional<String> id = annotation.get("id", String.class); if (id.isPresent()) { final AnnotationValueBuilder<?> builder = AnnotationValue.builder("io.micronaut.management.endpoint.annotation.Endpoint"); final Boolean enableByDefault = annotation.get("enableByDefault", boolean.class).orElse(true); builder.value(id.get()); builder.member("id",id.get()); builder.member("defaultEnabled", enableByDefault); return Collections.singletonList(builder.build()); } return Collections.emptyList(); }