Here you can find the source of getAnnotation(Class> clazz, Class annotationClass)
public static <A extends Annotation> A getAnnotation(Class<?> clazz, Class<A> annotationClass)
//package com.java2s; //License from project: Apache License import java.lang.annotation.Annotation; public class Main { public static <A extends Annotation> A getAnnotation(Class<?> clazz, Class<A> annotationClass) { return clazz.getAnnotation(annotationClass); }//www .ja v a 2s . c om public static <A extends Annotation> A getAnnotation(Class<?> clazz, Class<A> annotationClass, A defaultAnnotation) { A annotation = clazz.getAnnotation(annotationClass); if (annotation == null) return defaultAnnotation; return annotation; } }