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 SummaryConstructorsConstructorDescriptionCreate a default resolver instance without message conversion.Create a resolver instance with the givenMessageConverter.
- 
Method SummaryModifier and TypeMethodDescriptionprotected Class<?>getPayloadType(MethodParameter parameter, Message<?> message) Resolve the target class to convert the payload to.protected booleanisEmptyPayload(@Nullable 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- 
MessageMethodArgumentResolverpublic MessageMethodArgumentResolver()Create a default resolver instance without message conversion.
- 
MessageMethodArgumentResolverCreate a resolver instance with the givenMessageConverter.- Parameters:
- converter- the MessageConverter to use (may be- null)
- Since:
- 4.3
 
 
- 
- 
Method Details- 
supportsParameterDescription copied from interface:HandlerMethodArgumentResolverWhether the given method parameter is supported by this resolver.- Specified by:
- supportsParameterin interface- HandlerMethodArgumentResolver
- Parameters:
- parameter- the method parameter to check
- Returns:
- trueif this resolver supports the supplied parameter;- falseotherwise
 
- 
resolveArgumentDescription copied from interface:HandlerMethodArgumentResolverResolves a method parameter into an argument value from a given message.- Specified by:
- resolveArgumentin interface- HandlerMethodArgumentResolver
- Parameters:
- parameter- the method parameter to resolve. This parameter must have previously been passed to- HandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)which must have returned- true.
- message- the currently processed message
- Returns:
- the resolved argument value, or null
- Throws:
- Exception- in case of errors with the preparation of argument values
 
- 
getPayloadTypeResolve 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", for example, returnStringif target type isObjectand"Content-Type:text/**".- Parameters:
- parameter- the target method parameter
- message- the message being processed
- Returns:
- the target type to use
- Since:
- 5.2
 
- 
isEmptyPayloadCheck if the givenpayloadis empty.- Parameters:
- payload- the payload to check (can be- null)
 
 
-