org.springframework.web.reactive.result.method.annotation

## Class PathVariableMethodArgumentResolver

- java.lang.Object
- - org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
  - - org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver
    - - org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver
      - - org.springframework.web.reactive.result.method.annotation.PathVariableMethodArgumentResolver

- All Implemented Interfaces:
    HandlerMethodArgumentResolver, SyncHandlerMethodArgumentResolver

      public class PathVariableMethodArgumentResolver
      extends AbstractNamedValueSyncArgumentResolver

  Resolves method arguments annotated with @`PathVariable`.

  An @`PathVariable` is a named value that gets resolved from a URI template variable. It is always required and does not have a default value to fall back on. See the base class `AbstractNamedValueMethodArgumentResolver` for more information on how named values are processed.

  If the method parameter type is `Map`, the name specified in the annotation is used to resolve the URI variable String value. The value is then converted to a `Map` via type conversion, assuming a suitable `Converter`.

  Since:
    5.0
  Author:
    Rossen Stoyanchev, Juergen Hoeller
  See Also:
    `PathVariableMapMethodArgumentResolver`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver

      `AbstractNamedValueArgumentResolver.NamedValueInfo`

  - ### Field Summary

    - ### Fields inherited from class org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathVariableMethodArgumentResolver(ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry)` Create a new `PathVariableMethodArgumentResolver`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected AbstractNamedValueArgumentResolver.NamedValueInfo` | `createNamedValueInfo(MethodParameter parameter)` Create the `AbstractNamedValueArgumentResolver.NamedValueInfo` object for the given method parameter.
    `protected void` | `handleMissingValue(String name, MethodParameter parameter)` Invoked when a named value is required, but `AbstractNamedValueArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange)` returned `null` and there is no default value.
    `protected void` | `handleResolvedValue(Object arg, String name, MethodParameter parameter, Model model, ServerWebExchange exchange)` Invoked after a value is resolved.
    `protected Object` | `resolveNamedValue(String name, MethodParameter parameter, ServerWebExchange exchange)` Actually resolve the value synchronously.
    `boolean` | `supportsParameter(MethodParameter parameter)` Whether this resolver supports the given method parameter.

    - ### Methods inherited from class org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver

      `resolveArgument, resolveArgumentValue, resolveName`

    - ### Methods inherited from class org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver

      `handleMissingValue`

    - ### Methods inherited from class org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport

      `checkAnnotatedParamNoReactiveWrapper, checkParameterType, checkParameterTypeNoReactiveWrapper, getAdapterRegistry`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PathVariableMethodArgumentResolver

          public PathVariableMethodArgumentResolver(@Nullable
                                                    ConfigurableBeanFactory factory,
                                                    ReactiveAdapterRegistry registry)

      Create a new `PathVariableMethodArgumentResolver`.
      Parameters:
        `factory` - a bean factory to use for resolving `${...}` placeholder and `#{...}` SpEL expressions in default values; or `null` if default values are not expected to contain expressions
        `registry` - for checking reactive type wrappers

  - ### Method Detail

    - #### supportsParameter

          public boolean supportsParameter(MethodParameter parameter)

      Description copied from interface: `HandlerMethodArgumentResolver`
      Whether this resolver supports the given method parameter.
      Parameters:
        `parameter` - the method parameter

    - #### createNamedValueInfo

          protected AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)

      Description copied from class: `AbstractNamedValueArgumentResolver`
      Create the `AbstractNamedValueArgumentResolver.NamedValueInfo` object for the given method parameter. Implementations typically retrieve the method annotation by means of `MethodParameter.getParameterAnnotation(Class)`.
      Specified by:
        `createNamedValueInfo` in class `AbstractNamedValueArgumentResolver`
      Parameters:
        `parameter` - the method parameter
      Returns:
        the named value information

    - #### resolveNamedValue

          protected Object resolveNamedValue(String name,
                                             MethodParameter parameter,
                                             ServerWebExchange exchange)

      Description copied from class: `AbstractNamedValueSyncArgumentResolver`
      Actually resolve the value synchronously.
      Specified by:
        `resolveNamedValue` in class `AbstractNamedValueSyncArgumentResolver`

    - #### handleMissingValue

          protected void handleMissingValue(String name,
                                            MethodParameter parameter)

      Description copied from class: `AbstractNamedValueArgumentResolver`
      Invoked when a named value is required, but `AbstractNamedValueArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange)` returned `null` and there is no default value. Subclasses typically throw an exception in this case.
      Overrides:
        `handleMissingValue` in class `AbstractNamedValueArgumentResolver`
      Parameters:
        `name` - the name for the value
        `parameter` - the method parameter

    - #### handleResolvedValue

          protected void handleResolvedValue(@Nullable
                                             Object arg,
                                             String name,
                                             MethodParameter parameter,
                                             Model model,
                                             ServerWebExchange exchange)

      Description copied from class: `AbstractNamedValueArgumentResolver`
      Invoked after a value is resolved.
      Overrides:
        `handleResolvedValue` in class `AbstractNamedValueArgumentResolver`
      Parameters:
        `arg` - the resolved argument value
        `name` - the argument name
        `parameter` - the argument parameter type
        `model` - the model
        `exchange` - the current exchange