Top Description Fields Constructors Methods
org.springframework.web.method.support

public Class CompositeUriComponentsContributor

extends Object
implements UriComponentsContributor
Class Inheritance
All Implemented Interfaces
org.springframework.web.method.support.UriComponentsContributor
Imports
java.util.ArrayList, .Arrays, .Collection, .Collections, .List, .Map, org.springframework.core.MethodParameter, org.springframework.core.convert.ConversionService, org.springframework.format.support.DefaultFormattingConversionService, org.springframework.lang.Nullable, org.springframework.web.util.UriComponentsBuilder

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.
Authors
Rossen Stoyanchev, Juergen Hoeller, Sam Brannen
Since
4.0

Field Summary

Modifier and TypeField and Description
private final List<Object>
private final ConversionService

Constructor Summary

AccessConstructor and Description
public
public
public
CompositeUriComponentsContributor(Collection<?> contributors, ConversionService
a ConversionService to use when method argument values need to be formatted as Strings before being added to the URI
cs
)

Create an instance from a collection of UriComponentsContributors or HandlerMethodArgumentResolvers.

Method Summary

Modifier and TypeMethod and Description
public void
contributeMethodArgument(MethodParameter
the controller method parameter (never null)
parameter
,
Object
the argument value (possibly null)
value
,
UriComponentsBuilder
the builder to update (never null)
builder
,
Map<String, Object>
a map to add URI variables to (never null)
uriVariables
,
ConversionService
a ConversionService to format values as Strings
conversionService
)

Implements org.springframework.web.method.support.UriComponentsContributor.contributeMethodArgument.

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.
public void
contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables)

An overloaded method that uses the ConversionService created at construction.

public boolean

Returns:

true if this CompositeUriComponentsContributor was created with contributors to delegate to
hasContributors
()

Determine if this CompositeUriComponentsContributor has any contributors.

public boolean
supportsParameter(MethodParameter parameter)

Implements org.springframework.web.method.support.UriComponentsContributor.supportsParameter.

Whether this contributor supports the given method parameter.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contributorsback to summary
private final List<Object> contributors
conversionServiceback to summary
private final ConversionService conversionService

Constructor Detail

CompositeUriComponentsContributorback to summary
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:UriComponentsContributor[]

a collection of UriComponentsContributor or HandlerMethodArgumentResolvers

CompositeUriComponentsContributorback to summary
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:Collection<?>

a collection of UriComponentsContributor or HandlerMethodArgumentResolvers

CompositeUriComponentsContributorback to summary
public CompositeUriComponentsContributor(Collection<?> contributors, 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, org.springframework.format.support.DefaultFormattingConversionService will be used by default.

Parameters
contributors:Collection<?>

a collection of UriComponentsContributor or HandlerMethodArgumentResolvers

cs:ConversionService

a ConversionService to use when method argument values need to be formatted as Strings before being added to the URI

Method Detail

contributeMethodArgumentback to summary
public void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables, ConversionService conversionService)

Implements org.springframework.web.method.support.UriComponentsContributor.contributeMethodArgument.

Doc from org.springframework.web.method.support.UriComponentsContributor.contributeMethodArgument.

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.

Parameters
parameter:MethodParameter

the controller method parameter (never null)

value:Object

the argument value (possibly null)

builder:UriComponentsBuilder

the builder to update (never null)

uriVariables:Map<String, Object>

a map to add URI variables to (never null)

conversionService:ConversionService

a ConversionService to format values as Strings

Annotations
@Override
contributeMethodArgumentback to summary
public void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables)

An overloaded method that uses the ConversionService created at construction.

hasContributorsback to summary
public boolean hasContributors()

Determine if this CompositeUriComponentsContributor has any contributors.

Returns:boolean

true if this CompositeUriComponentsContributor was created with contributors to delegate to

supportsParameterback to summary
public boolean supportsParameter(MethodParameter parameter)

Implements org.springframework.web.method.support.UriComponentsContributor.supportsParameter.

Doc from org.springframework.web.method.support.UriComponentsContributor.supportsParameter.

Whether this contributor supports the given method parameter.

Annotations
@Override