/** * Retrieves an annotation for the specified property of field, setter or getter. * * @param <T> the annotation type to be retrieved * @param parentClass the class * @param property the property * @param annotationClass the annotation * @return the field or setter/getter annotation or <code>null</code> if not found */ protected <T extends Annotation> T getAnnotation(Class parentClass, String property, Class<T> annotationClass) { T annotation = null; Field field = reflectionProvider.getField(parentClass, property); if (field != null) { annotation = field.getAnnotation(annotationClass); } if (annotation == null) { // HINT: try with setter annotation = getAnnotationFromSetter(parentClass, property, annotationClass); } if (annotation == null) { // HINT: try with getter annotation = getAnnotationFromGetter(parentClass, property, annotationClass); } return annotation; }