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

The following examples show how to use javax.enterprise.inject.spi.BeanManager#isStereotype() . 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: AnnotationUtils.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
public static  <T extends Annotation> T findAnnotation(
        BeanManager beanManager, Annotation[] annotations, Class<T> targetAnnotationType)
{
    for (Annotation annotation : annotations)
    {
        if (targetAnnotationType.equals(annotation.annotationType()))
        {
            return (T) annotation;
        }
        if (beanManager.isStereotype(annotation.annotationType()))
        {
            T result = findAnnotation(
                    beanManager, annotation.annotationType().getAnnotations(), targetAnnotationType);
            if (result != null)
            {
                return result;
            }
        }
    }
    return null;
}
 
Example 2
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 3
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);
                }  
            }
        }
    }
}