private List getInterceptableBusinessMethods()

in webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java [709:765]


    private List<AnnotatedMethod> getInterceptableBusinessMethods(AnnotatedType annotatedType)
    {
        Class<?> javaClass = annotatedType.getJavaClass();
        List<Method> interceptableMethods = ClassUtil.getNonPrivateMethods(javaClass, false);

        List<AnnotatedMethod> interceptableAnnotatedMethods = new ArrayList<>();

        AnnotatedElementFactory annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
        Set<AnnotatedMethod> annotatedMethods = (Set<AnnotatedMethod>) annotatedElementFactory.getFilteredAnnotatedMethods(annotatedType);
        if (!javaClass.isAnnotation() && javaClass.isInterface())
        {
            Set<Type> types = new HashSet<>(annotatedType.getTypeClosure());
            types.remove(javaClass);
            types.remove(Object.class);

            if (!types.isEmpty()) // AT only supports 1 parent and ignores interface inheritance so add it manually here
            {
                annotatedMethods = new HashSet<>(annotatedMethods); // otherwise it is not mutable by default
                for (Type c : types)
                {
                    if (!Class.class.isInstance(c))
                    {
                        continue;
                    }
                    Class parent = Class.class.cast(c);
                    AnnotatedType at = annotatedElementFactory.getAnnotatedType(parent);
                    if (at == null)
                    {
                        at = annotatedElementFactory.newAnnotatedType(parent);
                    }
                    if (at != null)
                    {
                        annotatedMethods.addAll((Set<AnnotatedMethod>) annotatedElementFactory.getFilteredAnnotatedMethods(at));
                    }
                }
            }
        }
        for (Method interceptableMethod : interceptableMethods)
        {
            for (AnnotatedMethod<?> annotatedMethod : annotatedMethods)
            {
                if (annotatedMethod.getJavaMember().equals(interceptableMethod))
                {
                    int modifiers = annotatedMethod.getJavaMember().getModifiers();
                    if (Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers))
                    {
                        // we must only intercept business methods
                        continue;
                    }

                    interceptableAnnotatedMethods.add(annotatedMethod);
                }
            }
        }

        return interceptableAnnotatedMethods;
    }