public static < A extends Annotation > Optional < A > findPropertyAnnotation ( BeanPropertyDefinition beanPropertyDefinition , Class < A > annotationClass ) { return tryGetFieldAnnotation ( beanPropertyDefinition , annotationClass ) . map ( Optional :: of ) . orElse ( tryGetGetterAnnotation ( beanPropertyDefinition , annotationClass ) ) . map ( Optional :: of ) . orElse ( tryGetSetterAnnotation ( beanPropertyDefinition , annotationClass ) ) ; }
Finds first annotation of the given type on the given bean property and returns it . Search precedence is getter setter field .