static Map<Class<? extends Annotation>, Annotation> getMethodAnnotationMap(Method method, Collection<Class<? extends Annotation>> annotationClasses) {
        Annotation[] methodAnnotations = method.getAnnotations();
        Map<Class<? extends Annotation>, Annotation> methodAnnotationMap = new HashMap<>();
        for (Annotation methodAnnotation : methodAnnotations) {
            methodAnnotationMap.put(methodAnnotation.annotationType(), methodAnnotation);
        }
        methodAnnotationMap.keySet().retainAll(annotationClasses);
        return methodAnnotationMap;
    }
static Map < Class < ? extends Annotation > , Annotation > getMethodAnnotationMap ( Method method , Collection < Class < ? extends Annotation > > annotationClasses ) { Annotation [ ] methodAnnotations = method . getAnnotations ( ) ; Map < Class < ? extends Annotation > , Annotation > methodAnnotationMap = new HashMap < > ( ) ; for ( Annotation methodAnnotation : methodAnnotations ) { methodAnnotationMap . put ( methodAnnotation . annotationType ( ) , methodAnnotation ) ; } methodAnnotationMap . keySet ( ) . retainAll ( annotationClasses ) ; return methodAnnotationMap ; }
@return a map of annotations on the method that belong to the given collection.