/** * Sets the value member to the given type object. * * @param name The name of the member * @param type The type * @return This builder */ public AnnotationValueBuilder<T> member(String name, @Nullable Class<?> type) { if (type != null) { values.put(name, new AnnotationClassValue<>(type)); } return this; }
/** * Sets the value member to the given type objects. * * @param name The name of the member * @param types The type[] * @return This builder */ public AnnotationValueBuilder<T> member(String name, @Nullable Class<?>... types) { if (types != null) { AnnotationClassValue[] classValues = new AnnotationClassValue[types.length]; for (int i = 0; i < types.length; i++) { Class<?> type = types[i]; classValues[i] = new AnnotationClassValue<>(type); } values.put(name, classValues); } return this; }
@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 AnnotationClassValue annotationClassValue = annotation.getValue(AnnotationClassValue.class).orElseGet(() -> annotation.get("type", String.class).map(AnnotationClassValue::new).orElse(null) ); if (annotationClassValue != null) { return Arrays.asList( AnnotationValue.builder(Requires.class) .member("condition", new AnnotationClassValue<>( "io.micronaut.spring.boot.condition.RequiresSingleCandidateCondition" )) .build(), AnnotationValue.builder("io.micronaut.spring.boot.condition.RequiresSingleCandidate") .member("value", annotationClassValue) .build() ); } return Collections.emptyList(); }
staticInit.visitLabel(new Label()); invokeLoadClassValueMethod(owningType, classWriter, staticInit, loadTypeMethods, new AnnotationClassValue(annotationName)); final Map<String, Object> value = entry.getValue(); pushAnnotationAttributes(owningType, classWriter, staticInit, value, loadTypeMethods);
staticInit.visitLabel(new Label()); invokeLoadClassValueMethod(owningType, classWriter, staticInit, loadTypeMethods, new AnnotationClassValue(annotationName)); pushAnnotationAttributes(owningType, classWriter, staticInit, annotationValues, loadTypeMethods); staticInit.invokeStatic(TYPE_DEFAULT_ANNOTATION_METADATA, METHOD_REGISTER_ANNOTATION_DEFAULTS);