private void commonProperties()

in cdi-extension-jaxrs/src/main/java/org/apache/aries/cdi/extension/jaxrs/JaxrsCDIExtension.java [195:245]


	private void commonProperties(
		ProcessPotentialService pat, Class<?> serviceType, boolean application, BeanManager beanManager) {

		beanManager.fireEvent(MergeServiceTypes.forEvent(pat).withTypes(serviceType).build());

		final AnnotatedTypeConfigurator<?> configurator = pat.configureAnnotatedType();
		final AnnotatedType<?> annotatedType = pat.getAnnotatedType();

		if (!annotatedType.isAnnotationPresent(JaxrsName.class)) {
			if (application) {
				configurator.add(
					JaxrsName.Literal.of(
						ofNullable((String)configuration.get(JaxrsWhiteboardConstants.JAX_RS_NAME)).orElse(
							JaxrsWhiteboardConstants.JAX_RS_DEFAULT_APPLICATION
						)
					)
				);
			}
			else {
				configurator.add(JaxrsName.Literal.of(annotatedType.getJavaClass().getSimpleName()));
			}
		}

		if (!application && !annotatedType.isAnnotationPresent(JaxrsApplicationSelect.class)) {
			ofNullable((String)configuration.get(JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT)).ifPresent(
				select -> configurator.add(JaxrsApplicationSelect.Literal.of(select))
			);
		}

		if (!annotatedType.isAnnotationPresent(JaxrsExtensionSelect.class)) {
			ofNullable((String[])configuration.get(JaxrsWhiteboardConstants.JAX_RS_EXTENSION_SELECT)).ifPresent(selects -> {
				if (selects.length > 0) {
					configurator.add(JaxrsExtensionSelect.Literal.of(selects));
				}
			});
		}

		if (!annotatedType.isAnnotationPresent(JaxrsWhiteboardTarget.class)) {
			ofNullable((String)configuration.get(JaxrsWhiteboardConstants.JAX_RS_WHITEBOARD_TARGET)).ifPresent(
				target -> configurator.add(JaxrsWhiteboardTarget.Literal.of(target))
			);
		}

		if (!annotatedType.isAnnotationPresent(ServiceInstance.class)) {
			Class<? extends Annotation> beanScope = Util.beanScope(annotatedType, Dependent.class);

			if (Dependent.class.equals(beanScope)) {
				configurator.add(ServiceInstance.Literal.of(ServiceScope.PROTOTYPE));
			}
		}
	}