Class MessageMethodArgumentResolver
java.lang.Object
org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver
- All Implemented Interfaces:
 HandlerMethodArgumentResolver
HandlerMethodArgumentResolver for Message method arguments.
 Validates that the generic type of the payload matches to the message value
 or otherwise applies MessageConverter to convert to the expected
 payload type.- Since:
 - 4.0
 - Author:
 - Rossen Stoyanchev, Stephane Nicoll, Juergen Hoeller
 
- 
Constructor Summary
ConstructorsConstructorDescriptionCreate a default resolver instance without message conversion.MessageMethodArgumentResolver(MessageConverter converter) Create a resolver instance with the givenMessageConverter. - 
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?>getPayloadType(MethodParameter parameter, Message<?> message) Resolve the target class to convert the payload to.protected booleanisEmptyPayload(Object payload) Check if the givenpayloadis empty.resolveArgument(MethodParameter parameter, Message<?> message) Resolves a method parameter into an argument value from a given message.booleansupportsParameter(MethodParameter parameter) Whether the given method parameter is supported by this resolver. 
- 
Constructor Details
- 
MessageMethodArgumentResolver
public MessageMethodArgumentResolver()Create a default resolver instance without message conversion. - 
MessageMethodArgumentResolver
Create a resolver instance with the givenMessageConverter.- Parameters:
 converter- the MessageConverter to use (may benull)- Since:
 - 4.3
 
 
 - 
 - 
Method Details
- 
supportsParameter
Description copied from interface:HandlerMethodArgumentResolverWhether the given method parameter is supported by this resolver.- Specified by:
 supportsParameterin interfaceHandlerMethodArgumentResolver- Parameters:
 parameter- the method parameter to check- Returns:
 trueif this resolver supports the supplied parameter;falseotherwise
 - 
resolveArgument
Description copied from interface:HandlerMethodArgumentResolverResolves a method parameter into an argument value from a given message.- Specified by:
 resolveArgumentin interfaceHandlerMethodArgumentResolver- Parameters:
 parameter- the method parameter to resolve. This parameter must have previously been passed toHandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)which must have returnedtrue.message- the currently processed message- Returns:
 - the resolved argument value, or 
null - Throws:
 Exception- in case of errors with the preparation of argument values
 - 
getPayloadType
Resolve the target class to convert the payload to.By default this is the generic type declared in the
Messagemethod parameter but that can be overridden to select a more specific target type after also taking into account the "Content-Type", e.g. returnStringif target type isObjectand"Content-Type:text/**".- Parameters:
 parameter- the target method parametermessage- the message being processed- Returns:
 - the target type to use
 - Since:
 - 5.2
 
 - 
isEmptyPayload
Check if the givenpayloadis empty.- Parameters:
 payload- the payload to check (can benull)
 
 -