class InvocableHelper
extends java.lang.Object
InvocableHandlerMethod
, and to then
apply return value handling and exception handling. Holds all necessary
configuration necessary to do so.Modifier and Type | Field and Description |
---|---|
private HandlerMethodArgumentResolverComposite |
argumentResolvers |
private java.util.Map<MessagingAdviceBean,AbstractExceptionHandlerMethodResolver> |
exceptionHandlerAdviceCache |
private java.util.Map<java.lang.Class<?>,AbstractExceptionHandlerMethodResolver> |
exceptionHandlerCache |
private java.util.function.Function<java.lang.Class<?>,AbstractExceptionHandlerMethodResolver> |
exceptionMethodResolverFactory |
private static Log |
logger |
private ReactiveAdapterRegistry |
reactiveAdapterRegistry |
private HandlerMethodReturnValueHandlerComposite |
returnValueHandlers |
Constructor and Description |
---|
InvocableHelper(java.util.function.Function<java.lang.Class<?>,AbstractExceptionHandlerMethodResolver> exceptionMethodResolverFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addArgumentResolvers(java.util.List<? extends HandlerMethodArgumentResolver> resolvers)
Add the arguments resolvers to use for message handling and exception
handling methods.
|
void |
addReturnValueHandlers(java.util.List<? extends HandlerMethodReturnValueHandler> handlers)
Add the return value handlers to use for message handling and exception
handling methods.
|
ReactiveAdapterRegistry |
getReactiveAdapterRegistry()
Return the configured registry for adapting reactive types.
|
<any> |
handleMessage(HandlerMethod handlerMethod,
Message<?> message) |
private <any> |
handleReturnValue(java.lang.Object returnValue,
HandlerMethod handlerMethod,
Message<?> message) |
InvocableHandlerMethod |
initExceptionHandlerMethod(HandlerMethod handlerMethod,
java.lang.Throwable ex)
Find an exception handling method for the given exception.
|
InvocableHandlerMethod |
initMessageMappingMethod(HandlerMethod handlerMethod)
Create
InvocableHandlerMethod with the configured arg resolvers. |
void |
registerExceptionHandlerAdvice(MessagingAdviceBean bean,
AbstractExceptionHandlerMethodResolver resolver)
Method to populate the MessagingAdviceBean cache (e.g.
|
void |
setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
Configure the registry for adapting various reactive types.
|
private static Log logger
private final HandlerMethodArgumentResolverComposite argumentResolvers
private final HandlerMethodReturnValueHandlerComposite returnValueHandlers
private ReactiveAdapterRegistry reactiveAdapterRegistry
private final java.util.function.Function<java.lang.Class<?>,AbstractExceptionHandlerMethodResolver> exceptionMethodResolverFactory
private final java.util.Map<java.lang.Class<?>,AbstractExceptionHandlerMethodResolver> exceptionHandlerCache
private final java.util.Map<MessagingAdviceBean,AbstractExceptionHandlerMethodResolver> exceptionHandlerAdviceCache
public InvocableHelper(java.util.function.Function<java.lang.Class<?>,AbstractExceptionHandlerMethodResolver> exceptionMethodResolverFactory)
public void addArgumentResolvers(java.util.List<? extends HandlerMethodArgumentResolver> resolvers)
public void addReturnValueHandlers(java.util.List<? extends HandlerMethodReturnValueHandler> handlers)
public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
By default this is an instance of ReactiveAdapterRegistry
with
default settings.
public ReactiveAdapterRegistry getReactiveAdapterRegistry()
public void registerExceptionHandlerAdvice(MessagingAdviceBean bean, AbstractExceptionHandlerMethodResolver resolver)
@MessageExceptionHandler
).public InvocableHandlerMethod initMessageMappingMethod(HandlerMethod handlerMethod)
InvocableHandlerMethod
with the configured arg resolvers.handlerMethod
- the target handler method to invoke@Nullable public InvocableHandlerMethod initExceptionHandlerMethod(HandlerMethod handlerMethod, java.lang.Throwable ex)
The default implementation searches methods in the class hierarchy of
the HandlerMethod first and if not found, it continues searching for
additional handling methods registered via
registerExceptionHandlerAdvice(org.springframework.messaging.handler.MessagingAdviceBean, org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver)
.
handlerMethod
- the method where the exception was raisedex
- the exception raised or signalednull
public <any> handleMessage(HandlerMethod handlerMethod, Message<?> message)
private <any> handleReturnValue(@Nullable java.lang.Object returnValue, HandlerMethod handlerMethod, Message<?> message)