Top Description Inners Constructors Methods
org.springframework.web.servlet.mvc.method.annotation

public Class MatrixVariableMethodArgumentResolver

extends AbstractNamedValueMethodArgumentResolver
Class Inheritance
Imports
java.util.ArrayList, .List, .Map, org.springframework.core.MethodParameter, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils, .MultiValueMap, .StringUtils, org.springframework.web.bind.MissingMatrixVariableException, .ServletRequestBindingException, org.springframework.web.bind.annotation.MatrixVariable, .ValueConstants, org.springframework.web.context.request.NativeWebRequest, .RequestAttributes, org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver, org.springframework.web.servlet.HandlerMapping

Resolves arguments annotated with @MatrixVariable.

If the method parameter is of type Map it will be resolved by MatrixVariableMapMethodArgumentResolver instead unless the annotation specifies a name in which case it is considered to be a single attribute of type map (vs multiple attributes collected in a map).

Authors
Rossen Stoyanchev, Sam Brannen
Since
3.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo
createNamedValueInfo(MethodParameter
the method parameter
parameter
)

Implements abstract org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Create the NamedValueInfo object for the given method parameter.

protected void
handleMissingValue(String
the name for the value
name
,
MethodParameter
the method parameter
parameter
)

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Invoked when a named value is required, but resolveName(String, MethodParameter, NativeWebRequest) returned null and there is no default value.

protected void
handleMissingValueAfterConversion(String
the name for the value
name
,
MethodParameter
the method parameter
parameter
,
NativeWebRequest
the current request
request
)

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValueAfterConversion.

Invoked when a named value is present but becomes null after conversion.

protected Object
resolveName(String
the name of the value being resolved
name
,
MethodParameter
the method parameter to resolve to an argument value (pre-nested in case of a java.util.Optional declaration)
parameter
,
NativeWebRequest
the current request
request
)

Implements abstract org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveName.

Resolve the given parameter type and value name into an argument value.

public boolean
supportsParameter(MethodParameter
the method parameter to check
parameter
)

Implements org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter.

Whether the given method parameter is supported by this resolver.

Inherited from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:
handleMissingValuehandleResolvedValueresolveArgument

Constructor Detail

MatrixVariableMethodArgumentResolverback to summary
public MatrixVariableMethodArgumentResolver()

Method Detail

createNamedValueInfoback to summary
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)

Implements abstract org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Create the NamedValueInfo object for the given method parameter. Implementations typically retrieve the method annotation by means of MethodParameter#getParameterAnnotation(Class).

Parameters
parameter:MethodParameter

the method parameter

Returns:AbstractNamedValueMethodArgumentResolver.NamedValueInfo

the named value information

Annotations
@Override
handleMissingValueback to summary
protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Invoked when a named value is required, but resolveName(String, MethodParameter, NativeWebRequest) returned null and there is no default value. Subclasses typically throw an exception in this case.

Parameters
name:String

the name for the value

parameter:MethodParameter

the method parameter

Annotations
@Override
handleMissingValueAfterConversionback to summary
protected void handleMissingValueAfterConversion(String name, MethodParameter parameter, NativeWebRequest request) throws Exception

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValueAfterConversion.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValueAfterConversion.

Invoked when a named value is present but becomes null after conversion.

Parameters
name:String

the name for the value

parameter:MethodParameter

the method parameter

request:NativeWebRequest

the current request

Annotations
@Override
resolveNameback to summary
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest request) throws Exception

Implements abstract org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveName.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveName.

Resolve the given parameter type and value name into an argument value.

Parameters
name:String

the name of the value being resolved

parameter:MethodParameter

the method parameter to resolve to an argument value (pre-nested in case of a java.util.Optional declaration)

request:NativeWebRequest

the current request

Returns:Object

the resolved argument (may be null)

Annotations
@Override
@SuppressWarnings:unchecked
@Nullable
Exceptions
Exception:
in case of errors
supportsParameterback to summary
public boolean supportsParameter(MethodParameter parameter)

Implements org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter.

Doc from org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter.

Whether the given method parameter is supported by this resolver.

Parameters
parameter:MethodParameter

the method parameter to check

Returns:boolean

true if this resolver supports the supplied parameter; false otherwise

Annotations
@Override
org.springframework.web.servlet.mvc.method.annotation back to summary

private final Class MatrixVariableMethodArgumentResolver.MatrixVariableNamedValueInfo

extends NamedValueInfo
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Constructor Detail

MatrixVariableNamedValueInfoback to summary
private MatrixVariableNamedValueInfo(MatrixVariable annotation)