Search in sources :

Example 1 with Configuration

use of org.osgi.service.cdi.annotations.Configuration in project aries by apache.

the class ConfigurationExtension method processInjectionTarget.

void processInjectionTarget(@Observes @SuppressWarnings("rawtypes") ProcessInjectionPoint pip) {
    InjectionPoint injectionPoint = pip.getInjectionPoint();
    Annotated annotated = injectionPoint.getAnnotated();
    Configuration configuration = annotated.getAnnotation(Configuration.class);
    if (configuration == null) {
        return;
    }
    Class<?> beanClass = injectionPoint.getBean().getBeanClass();
    String name = beanClass.getName();
    Named named = annotated.getAnnotation(Named.class);
    if (named != null) {
        name = named.value();
    }
    ConfigurationDependency configurationDependency = new ConfigurationDependency(_bundleContext, configuration.value(), configuration.required(), name, injectionPoint);
    _configurations.add(configurationDependency);
    if (_log.isDebugEnabled()) {
        _log.debug("CDIe - Found OSGi configuration dependency {}", configurationDependency);
    }
}
Also used : Annotated(javax.enterprise.inject.spi.Annotated) Named(javax.inject.Named) Configuration(org.osgi.service.cdi.annotations.Configuration) ProcessInjectionPoint(javax.enterprise.inject.spi.ProcessInjectionPoint) InjectionPoint(javax.enterprise.inject.spi.InjectionPoint)

Aggregations

Annotated (javax.enterprise.inject.spi.Annotated)1 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)1 ProcessInjectionPoint (javax.enterprise.inject.spi.ProcessInjectionPoint)1 Named (javax.inject.Named)1 Configuration (org.osgi.service.cdi.annotations.Configuration)1