public void discover()

in cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Discovery.java [136:212]


	public void discover() {
		_beansModel.getOSGiBeans().forEach(osgiBean -> {
			osgiBean.found(true);

			AnnotatedType<?> annotatedType = new AnnotatedTypeImpl<>(osgiBean.getBeanClass());

			if (trimIt(annotatedType) || exclude(annotatedType)) {
				return;
			}

			try {
				if (annotatedType.isAnnotationPresent(SingleComponent.class)) {
					doFactoryOrSingleComponent(
							osgiBean, osgiBean.getBeanClass(), annotatedType, Annotates.beanName(annotatedType),
							Annotates.serviceClassNames(annotatedType), Annotates.serviceScope(annotatedType),
							Annotates.componentProperties(annotatedType), ComponentType.SINGLE);
				}
				else if (annotatedType.isAnnotationPresent(FactoryComponent.class)) {
					doFactoryOrSingleComponent(
							osgiBean, osgiBean.getBeanClass(), annotatedType, Annotates.beanName(annotatedType),
							Annotates.serviceClassNames(annotatedType), Annotates.serviceScope(annotatedType),
							Annotates.componentProperties(annotatedType), ComponentType.FACTORY);
				}
				else if (annotatedType.isAnnotationPresent(ComponentScoped.class)) {
					_componentScoped.add(osgiBean);
				}
				else {
					discoverActivations(osgiBean, osgiBean.getBeanClass(), annotatedType, null,
							Annotates.beanScope(annotatedType), Annotates.serviceClassNames(annotatedType));
				}
			}
			catch (Exception e) {
				_containerState.error(e);

				return;
			}

			annotatedType.getConstructors().stream().filter(this::isInject).flatMap(annotatedConstructor -> annotatedConstructor.getParameters().stream()).forEach(
				annotatedParameter ->
					processAnnotated(annotatedParameter, annotatedParameter.getBaseType(), Annotates.qualifiers(annotatedParameter), osgiBean)
			);

			annotatedType.getFields().stream().filter(this::isInject).forEach(
				annotatedField ->
					processAnnotated(annotatedField, annotatedField.getBaseType(), Annotates.qualifiers(annotatedField), osgiBean)
			);

			annotatedType.getFields().stream().filter(this::isProduces).forEach(
				annotatedField -> {
					Class<? extends Annotation> beanScope = Annotates.beanScope(annotatedField);
					List<String> serviceTypes = Annotates.serviceClassNames(annotatedField);
					discoverActivations(osgiBean, osgiBean.getBeanClass(), annotatedField, annotatedField, beanScope, serviceTypes);
				}
			);

			annotatedType.getMethods().forEach(annotatedMethod -> {
				if (isInjectOrProduces(annotatedMethod)) {
					annotatedMethod.getParameters().forEach(
						annotatedParameter -> processAnnotated(annotatedParameter, annotatedParameter.getBaseType(), Annotates.qualifiers(annotatedParameter), osgiBean)
					);

					if (isProduces(annotatedMethod)) {
						Class<? extends Annotation> beanScope = Annotates.beanScope(annotatedMethod);
						List<String> serviceTypes = Annotates.serviceClassNames(annotatedMethod);
						discoverActivations(osgiBean, osgiBean.getBeanClass(), annotatedMethod, annotatedMethod, beanScope, serviceTypes);
					}
				}
				else if (isDisposeOrObserves(annotatedMethod)) {
					annotatedMethod.getParameters().stream().skip(1).forEach(
						annotatedParameter -> processAnnotated(annotatedParameter, annotatedParameter.getBaseType(), Annotates.qualifiers(annotatedParameter), osgiBean)
					);
				}
			});
		});

		postProcessComponentScopedBeans();
	}