protected boolean canRegister ( Route route , ControllerHandler handler ) { if ( ! METHODS . contains ( route . getRequestMethod ( ) . toUpperCase ( ) ) ) { log . debug ( "Skip {} {}, {} Swagger does not support specified HTTP method" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } List < String > produces = handler . getDeclaredProduces ( ) ; if ( produces . isEmpty ( ) ) { log . debug ( "Skip {} {}, {} does not declare @Produces" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } if ( handler . getDeclaredReturns ( ) . isEmpty ( ) ) { log . debug ( "Skip {} {}, {} does not declare expected @Returns" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } if ( handler . getControllerMethod ( ) . isAnnotationPresent ( Undocumented . class ) || handler . getControllerMethod ( ) . getDeclaringClass ( ) . isAnnotationPresent ( Undocumented . class ) ) { log . debug ( "Skip {} {}, {} is annotated as @Undocumented" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } if ( ! route . getUriPattern ( ) . startsWith ( relativeSwaggerBasePath ) ) { log . debug ( "Skip {} {}, {} route is not within Swagger basePath '{}'" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) , relativeSwaggerBasePath ) ; return false ; } return true ; }
Determines if this controller handler can be registered in the Swagger specification .