use of javax.enterprise.inject.spi.InjectionPoint in project jersey by jersey.
the class CdiComponentProvider method processInjectionTarget.
@SuppressWarnings("unused")
private void processInjectionTarget(@Observes final ProcessInjectionTarget event) {
final InjectionTarget it = event.getInjectionTarget();
final Class<?> componentClass = event.getAnnotatedType().getJavaClass();
final Set<InjectionPoint> cdiInjectionPoints = filterHk2InjectionPointsOut(it.getInjectionPoints());
for (final InjectionPoint injectionPoint : cdiInjectionPoints) {
final Member member = injectionPoint.getMember();
if (member instanceof Field) {
addInjecteeToSkip(componentClass, fieldsToSkip, (Field) member);
} else if (member instanceof Method) {
addInjecteeToSkip(componentClass, methodsToSkip, (Method) member);
}
}
InjectionManagerInjectedCdiTarget target = null;
if (isJerseyOrDependencyType(componentClass)) {
target = new InjectionManagerInjectedCdiTarget(it) {
@Override
public Set<InjectionPoint> getInjectionPoints() {
// CDI will not treat these classes as CDI beans (as they are not).
return Collections.emptySet();
}
};
} else if (isJaxRsComponentType(componentClass) || jaxrsInjectableTypes.contains(event.getAnnotatedType().getBaseType())) {
target = new InjectionManagerInjectedCdiTarget(it) {
@Override
public Set<InjectionPoint> getInjectionPoints() {
// Inject CDI beans into JAX-RS resources/providers/application.
return cdiInjectionPoints;
}
};
}
if (target != null) {
notify(target);
//noinspection unchecked
event.setInjectionTarget(target);
}
}
use of javax.enterprise.inject.spi.InjectionPoint in project aries by apache.
the class ReferenceExtension method processInjectionTarget.
void processInjectionTarget(@Observes @SuppressWarnings("rawtypes") ProcessInjectionPoint pip, BeanManager manager) {
InjectionPoint injectionPoint = pip.getInjectionPoint();
Annotated annotated = injectionPoint.getAnnotated();
Reference reference = annotated.getAnnotation(Reference.class);
if (reference == null) {
return;
}
try {
BeanManagerImpl beanManagerImpl = ((BeanManagerProxy) manager).delegate();
ReferenceDependency referenceDependency = new ReferenceDependency(beanManagerImpl, reference, injectionPoint);
_referenceDependencies.add(referenceDependency);
if (_log.isDebugEnabled()) {
_log.debug("CDIe - Found OSGi service reference {}", referenceDependency);
}
} catch (Exception e) {
if (_log.isErrorEnabled()) {
_log.error("CDIe - Error on reference {}", reference, e);
}
}
}
use of javax.enterprise.inject.spi.InjectionPoint in project aries by apache.
the class Phase_Publish method processConfigurationDependencies.
private void processConfigurationDependencies(BeanManagerImpl beanManagerImpl) {
for (ConfigurationDependency configurationDependency : _bc.getConfigurations()) {
InjectionPoint injectionPoint = configurationDependency.getInjectionPoint();
ConfigurationBean bean = new ConfigurationBean(configurationDependency, beanManagerImpl, injectionPoint.getType(), injectionPoint.getQualifiers());
beanManagerImpl.addBean(bean);
}
}
use of javax.enterprise.inject.spi.InjectionPoint 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);
}
}
use of javax.enterprise.inject.spi.InjectionPoint in project deltaspike by apache.
the class ConfigurationExtension method collectDynamicTypes.
public void collectDynamicTypes(@Observes ProcessBean<?> processBean) {
for (final InjectionPoint ip : processBean.getBean().getInjectionPoints()) {
final ConfigProperty annotation = ip.getAnnotated().getAnnotation(ConfigProperty.class);
if (annotation == null || annotation.converter() == ConfigResolver.Converter.class) {
continue;
}
dynamicConfigTypes.add(ip.getType());
}
}
Aggregations