Here you can find the source of getAnnotation(Class
public static <T extends Annotation> T getAnnotation(Class<T> cls, Method... methods)
//package com.java2s; //License from project: Open Source License import java.lang.annotation.Annotation; import java.lang.reflect.Method; public class Main { public static <T extends Annotation> T getAnnotation(Class<T> cls, Method... methods) { T annotation = null;/*from w ww. j a v a2 s. c om*/ for (Method method : methods) { if (method != null && (annotation = method.getAnnotation(cls)) != null) { return annotation; } } return null; } }