Here you can find the source of findAnnotation(AnnotatedElement annotated, Class
public static <T extends Annotation> T findAnnotation(AnnotatedElement annotated, Class<T> annotationClass)
//package com.java2s; //License from project: Apache License import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; public class Main { public static <T extends Annotation> T findAnnotation(AnnotatedElement annotated, Class<T> annotationClass) { T ret;/*www . j a va 2 s.c o m*/ if (annotated == null) { ret = null; } else { ret = annotated.getAnnotation(annotationClass); } return ret; } }