class Reflections {

    public Set<Method> getMethodsAnnotatedWith(Class<? extends Annotation> annotation) {
        ensureScan();
        synchronized (MONITOR) {
            Set<Method> result = annotationClassToMethod.get(annotation);
            if (result != null) {
                return result;
            }

            /* not tried before... */
            Set<Method> newResult = new LinkedHashSet<>();
            visitEveryClass(new Visitor() {

                @Override
                public void visit(Class<?> clazz) {
                    for (Method method : clazz.getDeclaredMethods()) {
                        if (method.getDeclaredAnnotation(annotation) != null) {
                            if (annotation.equals(UseCaseRestDoc.class)){
                                if (GeneratorConstants.DEBUG) {
                                    LOG.info("UsecaseRestDoc found:{}",clazz);
                                }
                            }
                            newResult.add(method);
                        }
                    }
                }
            });
            annotationClassToMethod.put(annotation, newResult);
            return newResult;
        }
    }

    public  Reflections();

}