private <A extends Annotation> void visitMethod(A annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { AnnotationProcessor<A> processor = getProcessor(annotation); if (processor != null) { processor.visitMethod(annotation, method, implClass, componentType, context); } }
private <A extends Annotation> void visitMethod(A annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { AnnotationProcessor<A> processor = getProcessor(annotation); if (processor != null) { processor.visitMethod(annotation, method, implClass, componentType, context); } else { // check if the annotation is a policy if (policyProcessor != null) { policyProcessor.process(annotation, componentType, context); } } }
@SuppressWarnings("unchecked") private void processAnnotations(Object instance, Component<?> definition, IntrospectionContext context) { InjectingComponentType componentType = (InjectingComponentType) definition.getComponentType(); Class<?> implClass = instance.getClass(); // handle consumer annotations AnnotationProcessor consumerProcessor = annotationProcessors.get(org.fabric3.api.annotation.Consumer.class); for (Method method : implClass.getDeclaredMethods()) { org.fabric3.api.annotation.Consumer consumer = method.getAnnotation(org.fabric3.api.annotation.Consumer.class); if (consumer == null) { continue; } TypeMapping mapping = context.getTypeMapping(implClass); if (mapping == null) { mapping = new TypeMapping(); context.addTypeMapping(implClass, mapping); } helper.resolveTypeParameters(implClass, mapping); consumerProcessor.visitMethod(consumer, method, implClass, componentType, context); } // add automatic configuration for consumer annotations for (Consumer<ComponentType> consumer : componentType.getConsumers().values()) { String name = consumer.getName(); Consumer<Component> componentConsumer = new Consumer<>(name); componentConsumer.setSources(Collections.singletonList(URI.create(name))); definition.add(componentConsumer); } }