Here you can find the source of getAnnotations(Method method)
public static <A extends Annotation> A[] getAnnotations(Method method)
//package com.java2s; //License from project: Apache License import java.lang.annotation.Annotation; import java.lang.reflect.*; public class Main { public static <A extends Annotation> A[] getAnnotations(Method method) { return (A[]) method.getAnnotations(); }//from www.j av a 2 s . co m public static <A extends Annotation> A[] getAnnotations(Class clazz) { return (A[]) clazz.getAnnotations(); } }