private boolean isRequired ( Field field ) { return field . getAnnotation ( Require . class ) != null // Use the field's declaring class for RequireAll; may be a super class || ( field . getDeclaringClass ( ) . getAnnotation ( RequireAll . class ) != null && field . getAnnotation ( NotRequired . class ) == null ) ; }
Determines whether a field is required or not based on combination of Require RequireAll and NotRequired annotations .