Top Description Methods
org.springframework.web.bind.annotation

public @Interface MatrixVariable

extends Annotation
Annotations
@Target:PARAMETER
@Retention:RUNTIME
@Documented
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.core.annotation.AliasFor

Annotation which indicates that a method parameter should be bound to a name-value pair within a path segment. Supported for RequestMapping annotated handler methods.

If the method parameter type is java.util.Map and a matrix variable name is specified, then the matrix variable value is converted to a java.util.Map assuming an appropriate conversion strategy is available.

If the method parameter is Map<String, String> or MultiValueMap<String, String> and a variable name is not specified, then the map is populated with all matrix variable names and values.

Authors
Rossen Stoyanchev, Sam Brannen
Since
3.2

Method Summary

Modifier and TypeMethod and Description
public String
defaultValue()

The default value to use as a fallback.

public String
name()

The name of the matrix variable.

public String
pathVar()

The name of the URI path variable where the matrix variable is located, if necessary for disambiguation (e.g. a matrix variable with the same name present in more than one path segment).

public boolean
required()

Whether the matrix variable is required.

public String
value()

Alias for name.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

defaultValueback to summary
public String defaultValue()

The default value to use as a fallback.

Supplying a default value implicitly sets required to false.

nameback to summary
public String name()

The name of the matrix variable.

Annotations
@AliasFor:value
Since
4.2
See Also
value
pathVarback to summary
public String pathVar()

The name of the URI path variable where the matrix variable is located, if necessary for disambiguation (e.g. a matrix variable with the same name present in more than one path segment).

requiredback to summary
public boolean required()

Whether the matrix variable is required.

Default is true, leading to an exception being thrown in case the variable is missing in the request. Switch this to false if you prefer a null if the variable is missing.

Alternatively, provide a defaultValue, which implicitly sets this flag to false.

valueback to summary
public String value()

Alias for name.

Annotations
@AliasFor:name