Class InvocableHandlerMethod

    • Constructor Detail

      • InvocableHandlerMethod

        public InvocableHandlerMethod(HandlerMethod handlerMethod)
        Create an instance from a HandlerMethod.
      • InvocableHandlerMethod

        public InvocableHandlerMethod(java.lang.Object bean,
                                      java.lang.reflect.Method method)
        Create an instance from a bean instance and a method.
      • InvocableHandlerMethod

        public InvocableHandlerMethod(java.lang.Object bean,
                                      java.lang.String methodName,
                                      java.lang.Class<?>... parameterTypes)
                               throws java.lang.NoSuchMethodException
        Construct a new handler method with the given bean instance, method name and parameters.
        bean - the object bean
        methodName - the method name
        parameterTypes - the method parameter types
        java.lang.NoSuchMethodException - when the method cannot be found
    • Method Detail

      • setParameterNameDiscoverer

        public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)
        Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g. default request attribute name).

        Default is a DefaultParameterNameDiscoverer.

      • invoke

        public java.lang.Object invoke(Message<?> message,
                                                 java.lang.Object... providedArgs)
                                          throws java.lang.Exception
        Invoke the method after resolving its argument values in the context of the given message.

        Argument values are commonly resolved through HandlerMethodArgumentResolvers. The providedArgs parameter however may supply argument values to be used directly, i.e. without argument resolution.

        message - the current message being processed
        providedArgs - "given" arguments matched by type, not resolved
        the raw value returned by the invoked method
        java.lang.Exception - raised if no suitable argument resolver can be found, or if the method raised an exception
      • doInvoke

        protected java.lang.Object doInvoke(java.lang.Object... args)
                                               throws java.lang.Exception
        Invoke the handler method with the given argument values.
      • getDetailedErrorMessage

        protected java.lang.String getDetailedErrorMessage(java.lang.String text)
        Adds HandlerMethod details such as the bean type and method signature to the message.
        text - error message to append the HandlerMethod details to