private boolean allowMethod ( Method method ) { // NinjaProperties-based route exclusions/inclusions if ( method . isAnnotationPresent ( Requires . class ) ) { String key = method . getAnnotation ( Requires . class ) . value ( ) ; String value = ninjaProperties . get ( key ) ; if ( value == null ) { return false ; } } // NinjaMode-based route exclusions/inclusions Set < NinjaMode > modes = Sets . newTreeSet ( ) ; for ( Annotation annotation : method . getAnnotations ( ) ) { Class < ? extends Annotation > annotationClass = annotation . annotationType ( ) ; if ( annotationClass . isAnnotationPresent ( RuntimeMode . class ) ) { RuntimeMode mode = annotationClass . getAnnotation ( RuntimeMode . class ) ; modes . add ( mode . value ( ) ) ; } } return modes . isEmpty ( ) || modes . contains ( runtimeMode ) ; }
Determines if this method may be registered as a route . Ninja properties are considered as well as runtime modes .