Package org.springframework.web.method.support

# Class CompositeUriComponentsContributor

java.lang.Object
org.springframework.web.method.support.CompositeUriComponentsContributor

All Implemented Interfaces:
  `UriComponentsContributor`

public class CompositeUriComponentsContributor extends Object implements UriComponentsContributor
A `UriComponentsContributor` containing a list of other contributors to delegate to and also encapsulating a specific `ConversionService` to use for formatting method argument values as Strings.

Since:
  4.0
Author:
  Rossen Stoyanchev, Juergen Hoeller, Sam Brannen

## Constructor Summary

Constructors
Constructor
Description
`CompositeUriComponentsContributor(Collection<?> contributors)`
Create an instance from a collection of `UriComponentsContributors` or `HandlerMethodArgumentResolvers`.
`CompositeUriComponentsContributor(Collection<?> contributors, org.springframework.core.convert.ConversionService cs)`
Create an instance from a collection of `UriComponentsContributors` or `HandlerMethodArgumentResolvers`.
`CompositeUriComponentsContributor(UriComponentsContributor... contributors)`
Create an instance from a collection of `UriComponentsContributors` or `HandlerMethodArgumentResolvers`.

## Method Summary

Modifier and Type
Method
Description
`void`
`contributeMethodArgument(org.springframework.core.MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables)`
An overloaded method that uses the ConversionService created at construction.
`void`
`contributeMethodArgument(org.springframework.core.MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, org.springframework.core.convert.ConversionService conversionService)`
Process the given method argument and either update the `UriComponentsBuilder` or add to the map with URI variables to use to expand the URI after all arguments are processed.
`boolean`
`hasContributors()`
Determine if this `CompositeUriComponentsContributor` has any contributors.
`boolean`
`supportsParameter(org.springframework.core.MethodParameter parameter)`
Whether this contributor supports the given method parameter.

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

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

## Constructor Details

### CompositeUriComponentsContributor

public CompositeUriComponentsContributor(UriComponentsContributor... contributors)
Create an instance from a collection of `UriComponentsContributors` or `HandlerMethodArgumentResolvers`. Since both of these tend to be implemented by the same class, the most convenient option is to obtain the configured `HandlerMethodArgumentResolvers` in `RequestMappingHandlerAdapter` and provide that to this constructor.

Parameters:
  `contributors` - a collection of `UriComponentsContributor` or `HandlerMethodArgumentResolvers`

### CompositeUriComponentsContributor

public CompositeUriComponentsContributor(Collection<?> contributors)
Create an instance from a collection of `UriComponentsContributors` or `HandlerMethodArgumentResolvers`. Since both of these tend to be implemented by the same class, the most convenient option is to obtain the configured `HandlerMethodArgumentResolvers` in `RequestMappingHandlerAdapter` and provide that to this constructor.

Parameters:
  `contributors` - a collection of `UriComponentsContributor` or `HandlerMethodArgumentResolvers`

### CompositeUriComponentsContributor

public CompositeUriComponentsContributor(@Nullable Collection<?> contributors, @Nullable org.springframework.core.convert.ConversionService cs)
Create an instance from a collection of `UriComponentsContributors` or `HandlerMethodArgumentResolvers`. Since both of these tend to be implemented by the same class, the most convenient option is to obtain the configured `HandlerMethodArgumentResolvers` in the `RequestMappingHandlerAdapter` and provide that to this constructor.

If the `ConversionService` argument is `null`, `DefaultFormattingConversionService` will be used by default.

Parameters:
  `contributors` - a collection of `UriComponentsContributor` or `HandlerMethodArgumentResolvers`
  `cs` - a ConversionService to use when method argument values need to be formatted as Strings before being added to the URI

## Method Details

### hasContributors

public boolean hasContributors()
Determine if this `CompositeUriComponentsContributor` has any contributors.

Returns:
  `true` if this `CompositeUriComponentsContributor` was created with contributors to delegate to

### supportsParameter

public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
Description copied from interface: `UriComponentsContributor`
Whether this contributor supports the given method parameter.

Specified by:
  `supportsParameter` in interface `UriComponentsContributor`

### contributeMethodArgument

public void contributeMethodArgument(org.springframework.core.MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, org.springframework.core.convert.ConversionService conversionService)
Description copied from interface: `UriComponentsContributor`
Process the given method argument and either update the `UriComponentsBuilder` or add to the map with URI variables to use to expand the URI after all arguments are processed.

Specified by:
  `contributeMethodArgument` in interface `UriComponentsContributor`
Parameters:
  `parameter` - the controller method parameter (never `null`)
  `value` - the argument value (possibly `null`)
  `builder` - the builder to update (never `null`)
  `uriVariables` - a map to add URI variables to (never `null`)
  `conversionService` - a ConversionService to format values as Strings

### contributeMethodArgument

public void contributeMethodArgument(org.springframework.core.MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables)
An overloaded method that uses the ConversionService created at construction.