Here you can find the source of getAnnotationClass(Annotation a)
@SuppressWarnings("unchecked") private static Class<? extends Annotation> getAnnotationClass(Annotation a)
//package com.java2s; //License from project: Open Source License import java.lang.annotation.Annotation; public class Main { @SuppressWarnings("unchecked") private static Class<? extends Annotation> getAnnotationClass(Annotation a) { Class<?>[] interfaces = a.getClass().getInterfaces(); assert interfaces.length == 1 : "Customize annotations with multiple interfaces are not supported: " + a.getClass();/*from w w w.jav a 2 s . c om*/ return (Class<? extends Annotation>) interfaces[0]; } }