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