Java Code Examples for javax.enterprise.inject.spi.BeanManager#isInterceptorBinding()

The following examples show how to use javax.enterprise.inject.spi.BeanManager#isInterceptorBinding() . 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: DefaultMockFilter.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
protected boolean isStereotypeWithInterceptor(Annotation stereotypeAnnotation, BeanManager beanManager)
{
    for (Annotation annotation : stereotypeAnnotation.annotationType().getAnnotations())
    {
        if (isStandardAnnotation(annotation))
        {
            continue;
        }

        if (beanManager.isInterceptorBinding(annotation.annotationType()) ||
            isStereotypeWithInterceptor(annotation, beanManager))
        {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: CDIInterceptorWrapperImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static List<Annotation> getBindings(Set<Annotation> annotations, BeanManager beanManager) {
    if (annotations == null || annotations.isEmpty()) {
        return Collections.emptyList();
    }
    List<Annotation> bindings = new ArrayList<>();
    for (Annotation annotation : annotations) {
        if (beanManager.isInterceptorBinding(annotation.annotationType())) {
            bindings.add(annotation);
        }
    }
    return bindings;
}
 
Example 3
Source File: DefaultMockFilter.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
protected boolean isEjbOrAnnotatedTypeWithInterceptorAnnotation(BeanManager beanManager,
                                                                Set<Annotation> annotations,
                                                                String origin)
{
    for (Annotation annotation : annotations)
    {
        if (annotation.annotationType().getName().startsWith(EJB_BASE_PACKAGE))
        {
            return true;
        }

        if (isStandardAnnotation(annotation))
        {
            continue;
        }

        if (beanManager.isInterceptorBinding(annotation.annotationType()) ||
            (beanManager.isStereotype(annotation.annotationType()) &&
                isStereotypeWithInterceptor(annotation, beanManager)))
        {
            LOG.warning("Skip mocking intercepted bean " + origin);

            return true;
        }
    }
    return false;
}
 
Example 4
Source File: DeltaSpikeProxyInterceptorLookup.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
private void addInterceptorBindings(BeanManager beanManager, ArrayList<Annotation> bindings,
        Annotation[] declaredAnnotations)
{
    for (Annotation annotation : declaredAnnotations)
    {
        if (bindings.contains(annotation))
        {
            continue;
        }
        
        Class<? extends Annotation> annotationType = annotation.annotationType();
        
        if (beanManager.isInterceptorBinding(annotationType))
        {
            bindings.add(annotation);
        }
        
        if (beanManager.isStereotype(annotationType))
        {
            for (Annotation subAnnotation : annotationType.getDeclaredAnnotations())
            {                    
                if (bindings.contains(subAnnotation))
                {
                    continue;
                }

                if (beanManager.isInterceptorBinding(subAnnotation.annotationType()))
                {
                    bindings.add(subAnnotation);
                }  
            }
        }
    }
}