@ SuppressWarnings ( "unchecked" ) private Set < Method > findControllerMethods ( ) { Set < Method > methods = Sets . newLinkedHashSet ( ) ; methods . addAll ( reflections . getMethodsAnnotatedWith ( Path . class ) ) ; boolean enableCustomHttpMethods = ninjaProperties . getBooleanWithDefault ( NINJA_CUSTOM_HTTP_METHODS , false ) ; if ( enableCustomHttpMethods ) { Reflections annotationReflections = new Reflections ( "" , new TypeAnnotationsScanner ( ) , new SubTypesScanner ( ) ) ; for ( Class < ? > httpMethod : annotationReflections . getTypesAnnotatedWith ( HttpMethod . class ) ) { if ( httpMethod . isAnnotation ( ) ) { methods . addAll ( reflections . getMethodsAnnotatedWith ( ( Class < ? extends Annotation > ) httpMethod ) ) ; } } } else { // Only look for standard HTTP methods annotations Reflections annotationReflections = new Reflections ( "ninja.jaxy" , new TypeAnnotationsScanner ( ) , new SubTypesScanner ( ) ) ; for ( Class < ? > httpMethod : annotationReflections . getTypesAnnotatedWith ( HttpMethod . class ) ) { if ( httpMethod . isAnnotation ( ) ) { methods . addAll ( reflections . getMethodsAnnotatedWith ( ( Class < ? extends Annotation > ) httpMethod ) ) ; } } } return methods ; }
Searches for Methods that have either a Path Annotation or a HTTP - Method Annotation