public static void validateMethodOrThrow ( Method method ) { Class < ? > returnType = method . getReturnType ( ) ; if ( returnType . equals ( Void . TYPE ) ) { return ; } else if ( ! Publisher . class . isAssignableFrom ( returnType ) ) { throw new UnsupportedOperationException ( "Service method return type can be Publisher only" ) ; } if ( method . getParameterCount ( ) > 1 ) { throw new UnsupportedOperationException ( "Service method can accept 0 or 1 parameters only" ) ; } }
Util function to perform basic validation of service message request .