Search in sources :

Example 1 with CdiInterceptorBean

use of org.apache.webbeans.component.CdiInterceptorBean in project tomee by apache.

the class BeanContext method createInterceptorData.

private InterceptorData createInterceptorData(final Interceptor<?> i) {
    final InterceptorData data;
    if (CdiInterceptorBean.class.isInstance(i)) {
        final CdiInterceptorBean cdiInterceptorBean = CdiInterceptorBean.class.cast(i);
        data = new InterceptorData(i.getBeanClass());
        data.getAroundInvoke().addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.AROUND_INVOKE));
        data.getPostConstruct().addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.POST_CONSTRUCT));
        data.getPreDestroy().addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.PRE_DESTROY));
        data.getPostActivate().addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.POST_ACTIVATE));
        data.getPrePassivate().addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.PRE_PASSIVATE));
        data.getAroundTimeout().addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.AROUND_TIMEOUT));
    /*
            AfterBegin, BeforeCompletion and AfterCompletion are ignored since not handled by CDI
             */
    } else {
        // TODO: here we are not as good as in previous since we loose inheritance for instance
        data = InterceptorData.scan(i.getBeanClass());
    }
    return data;
}
Also used : InterceptorData(org.apache.openejb.core.interceptor.InterceptorData) CdiInterceptorBean(org.apache.webbeans.component.CdiInterceptorBean)

Aggregations

InterceptorData (org.apache.openejb.core.interceptor.InterceptorData)1 CdiInterceptorBean (org.apache.webbeans.component.CdiInterceptorBean)1