private static List < NameAndType > getParamNames ( Element callbackMethod ) { Element parentClass = callbackMethod . getEnclosingElement ( ) ; String methodFullInfo = parentClass + "#" + callbackMethod ; ExecutableElement method = ( ExecutableElement ) callbackMethod ; if ( ! method . getModifiers ( ) . contains ( Modifier . PUBLIC ) ) { LOGGER . info ( methodFullInfo + " must be public." ) ; System . exit ( - 1 ) ; } if ( method . getReturnType ( ) . getKind ( ) != TypeKind . VOID ) { LOGGER . info ( methodFullInfo + " must return void." ) ; System . exit ( - 1 ) ; } List < NameAndType > paramNames = new ArrayList < NameAndType > ( ) ; for ( VariableElement param : method . getParameters ( ) ) { Param paramAnnotation = param . getAnnotation ( Param . class ) ; if ( paramAnnotation == null ) { LOGGER . info ( methodFullInfo + ": all parameters must be annotated with the @" + Param . class . getName ( ) ) ; System . exit ( - 1 ) ; } paramNames . add ( new NameAndType ( paramAnnotation . value ( ) , param . asType ( ) . toString ( ) ) ) ; } return paramNames ; }
Makes sure method is public returns void and all its parameters are annotated too .