Get classes that have a method with an annotation of the named type.

@param methodAnnotationName
the name of the method annotation.
@return A list of classes with a method that has an annotation of the named type, or the empty list if none.
497471
public ClassInfoList getClassesWithMethodAnnotation(final String methodAnnotationName) {
        if (closed.get()) {
            throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
        }
        if (!scanSpec.enableClassInfo || !scanSpec.enableMethodInfo || !scanSpec.enableAnnotationInfo) {
            throw new IllegalArgumentException("Please call ClassGraph#enableClassInfo(), #enableMethodInfo(), "
                    + "and #enableAnnotationInfo() before #scan()");
        }
        final ClassInfo classInfo = classNameToClassInfo.get(methodAnnotationName);
        return classInfo == null ? ClassInfoList.EMPTY_LIST : classInfo.getClassesWithMethodAnnotation();
    }
1102204
List<Method> getSortedCandidateMethods(String methodName, Method[] methods) {
		List<Method> candidates = new ArrayList<>();
		for (Method method : methods) {
			if (method.getName().equals(methodName)) {
				candidates.add(method);
			}
		}
		Collections.sort(candidates, comparator);
		return candidates;
	}
169154
public boolean hasDeclaredMethodParameterAnnotation(final String methodParameterAnnotationName) {
        for (final MethodInfo mi : getDeclaredMethodInfo()) {
            if (mi.hasParameterAnnotation(methodParameterAnnotationName)) {
                return true;
            }
        }
        return false;
    }
609918
public Set<Method> getMethodsAnnotatedWith(final Annotation annotation) {
        return filter(getMethodsAnnotatedWith(annotation.annotationType()), withAnnotation(annotation));
    }
666326
private static List<Annotation> getAnnotations(Method method) {
		if (methodAnnotationCache.containsKey(method)) {
			return methodAnnotationCache.get(method);
		}
		List<Annotation> annotations = new ArrayList<>();
		Collections.addAll(annotations, method.getAnnotations());
		annotations = Collections.unmodifiableList(annotations);
		methodAnnotationCache.put(method, annotations);
		return annotations;
	}
1317408
public Set<Constructor> getConstructorsWithAnyParamAnnotated(Class<? extends Annotation> annotation) {
        return getConstructorsFromDescriptors(store.get(index(MethodParameterScanner.class), annotation.getName()), loaders());
    }
667568
public static <T extends Annotation> List<T> getAnnotations(Method method, Class<T> type) {
		return filterAnnotations(getAnnotations(method), type);
	}
1280829
private static <T> List<Method> getMethods(Class<T> type, String... names) {

		Assert.notNull(type, "Missing class to search for methods!");
		Assert.notNullOrEmpty(names, "Missing method names to search for!");

		Map<String, Method> candidates = new HashMap<>();
		for (Method method : type.getMethods()) {

			if (Modifier.isStatic(method.getModifiers()) &&
			    method.getReturnType().equals(type) &&
			    method.getParameterTypes().length == 1 &&
			    method.getParameterTypes()[0].isAssignableFrom(String.class)) {

				candidates.put(method.getName(), method);
			}
		}

		List<Method> output = new ArrayList<>();

		// go in order desired
		for (String name : names) {
			if (candidates.containsKey(name)) {
				output.add(candidates.get(name));
			}
		}

		return output;
	}
760047
@Override
    public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
        return method.getAnnotation(annotationClass);
    }
157633
public static List<Method> getAllAnnotationPresentMethod(Class<?> type,
                                                             Class<? extends Annotation> annotation) {
        List<Method> methods = getAllMethod(type);

        if (methods.isEmpty()) {
            return Collections.emptyList();
        }

        return methods.stream().filter(method -> method.isAnnotationPresent(annotation))
            .collect(Collectors.toList());
    }
196211
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) {
        A annotation = method.getAnnotation(annotationClass);
        if (annotation == null) {
            for (Annotation metaAnnotation : method.getAnnotations()) {
                annotation = metaAnnotation.annotationType().getAnnotation(annotationClass);
                if (annotation != null) {
                    return annotation;
                }
            }
            Method superclassMethod = getOverriddenMethod(method);
            if (superclassMethod != null) {
                annotation = getAnnotation(superclassMethod, annotationClass);
            }
        }
        return annotation;
    }
836133
@SuppressWarnings("rawtypes")
    public Method getAnnotatedMethod(Class clazz, Class<? extends Annotation> annotationClass) {
        Method m = null;

        Method[] methods = clazz.getDeclaredMethods();

        for (int i = 0; i < methods.length; i++) {
            Annotation[] a = methods[i].getAnnotations();
            if (a != null) {
                for (int j = 0; j < a.length; j++) {
                    if (a[j].annotationType() == annotationClass) {
                        if (m == null) {
                            m = methods[i];
                        } else {
                            Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methods[i].getName(), clazz.getName() });
                        }
                    }
                }
            }
        }
        return m;
    }
370234
public static Annotation[] getAnnotations(Method method) {
		try {
			return BridgeMethodResolver.findBridgedMethod(method).getAnnotations();
		}
		catch (Exception ex) {
			// Assuming nested Class values not resolvable within annotation attributes...
			logIntrospectionFailure(method, ex);
			return null;
		}
	}
1026497
public static <T extends Annotation> Set<Method> getAnnotatedPublicMethods(Class<?> clazz, Class<T> annotation) {
		// 已递归到Objebt.class, 停止递归
		if (Object.class.equals(clazz)) {
			return Collections.emptySet();
		}

		List<Class<?>> ifcs = ClassUtils.getAllInterfaces(clazz);
		Set<Method> annotatedMethods = new HashSet<Method>();

		// 遍历当前类的所有公共方法
		Method[] methods = clazz.getMethods();

		for (Method method : methods) {
			// 如果当前方法有标注，或定义了该方法的所有接口有标注
			if (method.getAnnotation(annotation) != null || searchOnInterfaces(method, annotation, ifcs)) {
				annotatedMethods.add(method);
			}
		}

		return annotatedMethods;
	}
1146755
public static Matcher<MethodTree> methodIsNamed(final String methodName) {
    return new Matcher<MethodTree>() {
      @Override
      public boolean matches(MethodTree methodTree, VisitorState state) {
        return methodTree.getName().contentEquals(methodName);
      }
    };
  }
1162873
public static List<ConversionMethod> getConversionMethods(Class<?> clazz){
		List<ConversionMethod> conversions = new ArrayList<ConversionMethod>();
		
			for(Method method:getAnnotatedMethods(clazz))
				try{   conversions.add(Converter.toConversionMethod(method));
				}catch (ConversionParameterException e) {
					Error.wrongParameterNumber(method.getName(),clazz.getSimpleName());
				}catch (DynamicConversionParameterException e) {
					Error.parametersUsageNotAllowed(method.getName(), clazz.getSimpleName());
				}catch (DynamicConversionMethodException e) {
					Error.incorrectMethodDefinition(method.getName(), clazz.getSimpleName());
				}catch (DynamicConversionBodyException e) {
					Error.incorrectBodyDefinition(method.getName(), clazz.getSimpleName());
				}
		return conversions;
	}
1145112
public static List<List<Annotation>> findAndMergeParameterAnnotations(Method method) {
        List<List<Annotation>> res = new ArrayList<List<Annotation>>(method.getParameterTypes().length);
        for (int i = 0; i < method.getParameterTypes().length; i++) {
            res.add(new LinkedList<Annotation>());
        }
        findAndMergeAnnotations(method.getDeclaringClass(), method, res);
        return res;
    }