public class CompositeUriComponentsContributor extends Object implements UriComponentsContributor
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.Constructor and Description |
---|
CompositeUriComponentsContributor(Collection<?> contributors)
Create an instance from a collection of
UriComponentsContributors or
HandlerMethodArgumentResolvers . |
CompositeUriComponentsContributor(Collection<?> contributors,
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 . |
Modifier and Type | Method and Description |
---|---|
void |
contributeMethodArgument(MethodParameter parameter,
Object value,
UriComponentsBuilder builder,
Map<String,Object> uriVariables)
An overloaded method that uses the ConversionService created at construction.
|
void |
contributeMethodArgument(MethodParameter parameter,
Object value,
UriComponentsBuilder builder,
Map<String,Object> uriVariables,
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(MethodParameter parameter)
Whether this contributor supports the given method parameter.
|
public CompositeUriComponentsContributor(UriComponentsContributor... contributors)
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.contributors
- a collection of UriComponentsContributor
or HandlerMethodArgumentResolvers
public CompositeUriComponentsContributor(Collection<?> contributors)
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.contributors
- a collection of UriComponentsContributor
or HandlerMethodArgumentResolvers
public CompositeUriComponentsContributor(@Nullable Collection<?> contributors, @Nullable ConversionService cs)
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.
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 URIpublic boolean hasContributors()
CompositeUriComponentsContributor
has any
contributors.true
if this CompositeUriComponentsContributor
was created with contributors to delegate topublic boolean supportsParameter(MethodParameter parameter)
UriComponentsContributor
supportsParameter
in interface UriComponentsContributor
public void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, ConversionService conversionService)
UriComponentsContributor
UriComponentsBuilder
or add to the map with URI variables
to use to expand the URI after all arguments are processed.contributeMethodArgument
in interface UriComponentsContributor
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 Stringspublic void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables)