protected boolean isValidMethod ( Element element ) { // must be of type class if ( element . getKind ( ) != ElementKind . METHOD ) { error ( element , "Element %s annotated with annotation %s must be a method" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } // must be public if ( ! element . getModifiers ( ) . contains ( Modifier . PUBLIC ) ) { error ( element , "Method %s annotated with annotation %s must be public" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } // must not abstract if ( element . getModifiers ( ) . contains ( Modifier . ABSTRACT ) ) { error ( element , "Method %s annotated with annotation %s must not be abstract" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } // must not be static if ( element . getModifiers ( ) . contains ( Modifier . STATIC ) ) { error ( element , "Method %s annotated with annotation %s must not be static" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } return true ; }
Checks if passed element is a method declared as public not abstract and not static