Here you can find the source of findAnnotation(final Class
public static <T extends Annotation> T findAnnotation(final Class<T> annotationClass, final Class<?> beanClass, final Field field)
//package com.java2s; //License from project: Apache License import java.lang.annotation.Annotation; import java.lang.reflect.Field; public class Main { public static <T extends Annotation> T findAnnotation(final Class<T> annotationClass, final Class<?> beanClass, final Field field) { final T fieldAnnotation = field.getAnnotation(annotationClass); return fieldAnnotation == null ? beanClass.getAnnotation(annotationClass) : fieldAnnotation; }// w w w .j a v a 2 s. c om }