Class AbstractNamedValueArgumentResolver

java.lang.Object
org.springframework.web.service.invoker.AbstractNamedValueArgumentResolver
All Implemented Interfaces:
HttpServiceArgumentResolver
Direct Known Subclasses:
CookieValueArgumentResolver, MultipartFileArgumentResolver, PathVariableArgumentResolver, RequestAttributeArgumentResolver, RequestHeaderArgumentResolver, RequestParamArgumentResolver, RequestPartArgumentResolver

public abstract class AbstractNamedValueArgumentResolver extends Object implements HttpServiceArgumentResolver
Base class for arguments that resolve to a named request value such as a request header, path variable, cookie, and others.
Since:
6.0
Author:
Rossen Stoyanchev
  • Field Details

    • logger

      protected final Log logger
  • Constructor Details

    • AbstractNamedValueArgumentResolver

      protected AbstractNamedValueArgumentResolver(ConversionService conversionService)
      Constructor for a resolver to a String value.
      Parameters:
      conversionService - the ConversionService to use to format Object to String values
    • AbstractNamedValueArgumentResolver

      protected AbstractNamedValueArgumentResolver()
      Constructor for a resolver to an Object value, without conversion.
  • Method Details

    • resolve

      public boolean resolve(@Nullable Object argument, MethodParameter parameter, HttpRequestValues.Builder requestValues)
      Description copied from interface: HttpServiceArgumentResolver
      Resolve the argument value.
      Specified by:
      resolve in interface HttpServiceArgumentResolver
      Parameters:
      argument - the argument value
      parameter - the method parameter for the argument
      requestValues - builder to add HTTP request values to
      Returns:
      true if the argument was resolved, false otherwise
    • createNamedValueInfo

      @Nullable protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
      Return information about the request value, or null if the parameter does not represent a request value of interest.
    • addRequestValue

      protected abstract void addRequestValue(String name, Object value, MethodParameter parameter, HttpRequestValues.Builder requestValues)
      Add the given, single request value. This may be called multiples times if the request value is multivalued.

      If the resolver was created with a ConversionService, the value will have been converted to a String and may be cast down.

      Parameters:
      name - the request value name
      value - the value
      parameter - the method parameter type, nested if Map, List/array, or Optional
      requestValues - builder to add the request value to