private static List<AccessibleObject> collectInfo(Class<?> clazz,
                                                      Class<? extends Annotation> annotation) {

        Class superClazz = clazz;
        List<AccessibleObject> members = new ArrayList<>();
        List<AccessibleObject> annotatedMembers = new ArrayList<>();
        //walk through the inheritance chain
        while (superClazz != null && superClazz != Object.class) {
            members.addAll(Arrays.asList(superClazz.getDeclaredFields()));
            members.addAll(Arrays.asList(superClazz.getDeclaredMethods()));
            superClazz = superClazz.getSuperclass();
        }

        for (final AccessibleObject member : members) {
            if (member.isAnnotationPresent(annotation)) {
                member.setAccessible(true);
                annotatedMembers.add(member);
            }
        }
        return annotatedMembers;
    }
Collects all the fields and methods for an annotation

@param clazz      bean class with annotations
@param annotation annotation class
@return list of accessible objects such as fields and methods
tika-core/src/main/java/org/apache/tika/utils/AnnotationUtils.java