public static Object fetchAnnotationElementValue ( Annotation annotation , Method element ) throws ReflectiveOperationException { Object value = element . invoke ( annotation ) ; if ( value == null ) { String errorMsg = "@" + annotation . annotationType ( ) . getName ( ) + "." + element . getName ( ) + "() returned null" ; throw new NullPointerException ( errorMsg ) ; } return value ; }
Returns values if it is not null otherwise throws exception