Package org.springframework.web.service.invoker

# Class AbstractNamedValueArgumentResolver

java.lang.Object
org.springframework.web.service.invoker.AbstractNamedValueArgumentResolver

All Implemented Interfaces:
  `HttpServiceArgumentResolver`

Direct Known Subclasses:
  `CookieValueArgumentResolver`, `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, Olga Maciaszek-Sharma

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`AbstractNamedValueArgumentResolver.NamedValueInfo`
Info about a request value, typically extracted from a method parameter annotation.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final org.apache.commons.logging.Log`
`logger`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractNamedValueArgumentResolver()`
Constructor for a resolver to an Object value, without conversion.
`protected`
`AbstractNamedValueArgumentResolver(org.springframework.core.convert.ConversionService conversionService)`
Constructor for a resolver to a String value.

## Method Summary

Modifier and Type
Method
Description
`protected abstract void`
`addRequestValue(String name, Object value, org.springframework.core.MethodParameter parameter, HttpRequestValues.Builder requestValues)`
Add the given, single request value.
`protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo`
`createNamedValueInfo(org.springframework.core.MethodParameter parameter)`
Return information about the request value, or `null` if the parameter does not represent a request value of interest.
`protected AbstractNamedValueArgumentResolver.NamedValueInfo`
`createNamedValueInfo(org.springframework.core.MethodParameter parameter, HttpRequestValues.Metadata metadata)`
Variant of `createNamedValueInfo(MethodParameter)` that also provides access to the static values set from `@HttpExchange` attributes.
`boolean`
`resolve(Object argument, org.springframework.core.MethodParameter parameter, HttpRequestValues.Builder requestValues)`
Resolve the argument value.

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

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

## Field Details

### logger

protected final org.apache.commons.logging.Log logger

## Constructor Details

### AbstractNamedValueArgumentResolver

protected AbstractNamedValueArgumentResolver(org.springframework.core.convert.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, org.springframework.core.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(org.springframework.core.MethodParameter parameter)
Return information about the request value, or `null` if the parameter does not represent a request value of interest.

### createNamedValueInfo

@Nullable protected AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter, HttpRequestValues.Metadata metadata)
Variant of `createNamedValueInfo(MethodParameter)` that also provides access to the static values set from `@HttpExchange` attributes.

Since:
  6.2

### addRequestValue

protected abstract void addRequestValue(String name, Object value, org.springframework.core.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