Java Code Examples for javax.enterprise.inject.spi.InjectionTarget#getInjectionPoints()

The following examples show how to use javax.enterprise.inject.spi.InjectionTarget#getInjectionPoints() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CdiEjbBean.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Override
public InjectionTarget<T> createInjectionTarget(final Bean<T> bean) {
    final EjbInjectionTargetImpl<T> injectionTarget = new EjbInjectionTargetImpl<>(getAnnotatedType(), createInjectionPoints(bean), getWebBeansContext());
    final InjectionTarget<T> it = getWebBeansContext().getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget, getAnnotatedType()).getInjectionTarget();

    for (final InjectionPoint ip : it.getInjectionPoints()) {
        if (ip.getType() != UserTransaction.class) {
            continue;
        }
        if (beanContext.getTransactionType() != TransactionType.BeanManaged) {
            throw new DefinitionException("@Inject UserTransaction is only valid for BeanManaged beans");
        }
    }

    if (!EjbInjectionTargetImpl.class.isInstance(it)) {
        return new EjbInjectionTargetImpl<>(injectionTarget, it);
    }
    return it;
}
 
Example 2
Source File: BeanBuilder.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
/**
 * Set the ContextualLifecycle and the InjectionPoints for the AnnotatedType
 * @param type
 */
protected void setDefaultBeanLifecycle(AnnotatedType<T> type)
{
    InjectionTarget<T> injectionTarget;
    if (!type.getJavaClass().isInterface())
    {
        injectionTarget = beanManager.createInjectionTarget(type);
    }
    else
    {
        injectionTarget = new DummyInjectionTarget<T>();
    }
    this.beanLifecycle = new DelegatingContextualLifecycle<T>(injectionTarget);
    this.injectionPoints = injectionTarget.getInjectionPoints();
}