public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver
@Header
.AbstractNamedValueMethodArgumentResolver.NamedValueInfo
Constructor and Description |
---|
HeaderMethodArgumentResolver(ConversionService cs,
ConfigurableBeanFactory beanFactory) |
Modifier and Type | Method and Description |
---|---|
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(MethodParameter parameter)
Create the
AbstractNamedValueMethodArgumentResolver.NamedValueInfo object for the given method parameter. |
protected void |
handleMissingValue(java.lang.String headerName,
MethodParameter parameter,
Message<?> message)
Invoked when a named value is required, but
AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(MethodParameter, Message, String) returned null and
there is no default value. |
protected java.lang.Object |
resolveArgumentInternal(MethodParameter parameter,
Message<?> message,
java.lang.String name)
Resolves the given parameter type and value name into an argument value.
|
boolean |
supportsParameter(MethodParameter parameter)
Whether the given method parameter is
supported by this resolver.
|
handleResolvedValue, resolveArgument
public HeaderMethodArgumentResolver(ConversionService cs, ConfigurableBeanFactory beanFactory)
public boolean supportsParameter(MethodParameter parameter)
HandlerMethodArgumentResolver
parameter
- the method parameter to checktrue
if this resolver supports the supplied parameter;
false
otherwiseprotected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
object for the given method parameter. Implementations typically
retrieve the method annotation by means of MethodParameter.getParameterAnnotation(Class)
.createNamedValueInfo
in class AbstractNamedValueMethodArgumentResolver
parameter
- the method parameter@Nullable protected java.lang.Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, java.lang.String name) throws java.lang.Exception
AbstractNamedValueMethodArgumentResolver
resolveArgumentInternal
in class AbstractNamedValueMethodArgumentResolver
parameter
- the method parameter to resolve to an argument valuemessage
- the current requestname
- the name of the value being resolvednull
java.lang.Exception
- in case of errorsprotected void handleMissingValue(java.lang.String headerName, MethodParameter parameter, Message<?> message)
AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(MethodParameter, Message, String)
returned null
and
there is no default value. Subclasses typically throw an exception in this case.handleMissingValue
in class AbstractNamedValueMethodArgumentResolver
headerName
- the name for the valueparameter
- the method parametermessage
- the message being processed