public class ControllerLinkBuilderFactory extends Object implements MethodLinkBuilderFactory<ControllerLinkBuilder>
LinkBuilderSupport
instances based on the request mapping annotated on the given controller.Constructor and Description |
---|
ControllerLinkBuilderFactory() |
Modifier and Type | Method and Description |
---|---|
protected UriComponentsBuilder |
applyUriComponentsContributer(UriComponentsBuilder builder,
DummyInvocationUtils.MethodInvocation invocation)
Applies the configured
UriComponentsContributor s to the given UriComponentsBuilder . |
ControllerLinkBuilder |
linkTo(Class<?> controller)
Creates a new
LinkBuilder with a base of the mapping annotated to the given target class (controller,
service, etc.). |
ControllerLinkBuilder |
linkTo(Class<?> controller,
Map<String,?> parameters)
Creates a new
LinkBuilder with a base of the mapping annotated to the given target class (controller,
service, etc.). |
ControllerLinkBuilder |
linkTo(Class<?> controller,
Method method,
Object... parameters)
Returns a
LinkBuilder pointing to the URI mapped to the given Method assuming it was invoked on an
object of the given type. |
ControllerLinkBuilder |
linkTo(Class<?> controller,
Object... parameters)
Creates a new
LinkBuilder with a base of the mapping annotated to the given target class (controller,
service, etc.). |
ControllerLinkBuilder |
linkTo(Method method,
Object... parameters)
Returns a
LinkBuilder pointing to the URI mapped to the given Method and expanding this mapping
using the given parameters. |
ControllerLinkBuilder |
linkTo(Object invocationValue)
Returns a
LinkBuilder pointing to the URI mapped to the method the result is handed into this method. |
void |
setUriComponentsContributors(List<? extends UriComponentsContributor> uriComponentsContributors)
Configures the
UriComponentsContributor to be used when building Link instances from method
invocations. |
public void setUriComponentsContributors(List<? extends UriComponentsContributor> uriComponentsContributors)
UriComponentsContributor
to be used when building Link
instances from method
invocations.uriComponentsContributors
- the uriComponentsContributors to setlinkTo(Object)
public ControllerLinkBuilder linkTo(Class<?> controller)
LinkBuilderFactory
LinkBuilder
with a base of the mapping annotated to the given target class (controller,
service, etc.).linkTo
in interface LinkBuilderFactory<ControllerLinkBuilder>
controller
- must not be null.public ControllerLinkBuilder linkTo(Class<?> controller, Object... parameters)
LinkBuilderFactory
LinkBuilder
with a base of the mapping annotated to the given target class (controller,
service, etc.). The additional parameters are used to fill up potentially available path variables in the class
scope request mapping.linkTo
in interface LinkBuilderFactory<ControllerLinkBuilder>
controller
- must not be null.parameters
- must not be null.public ControllerLinkBuilder linkTo(Class<?> controller, Map<String,?> parameters)
LinkBuilderFactory
LinkBuilder
with a base of the mapping annotated to the given target class (controller,
service, etc.). Parameter map is used to fill up potentially available path variables in the class scope request
mapping.linkTo
in interface LinkBuilderFactory<ControllerLinkBuilder>
controller
- must not be null.parameters
- must not be null.public ControllerLinkBuilder linkTo(Class<?> controller, Method method, Object... parameters)
MethodLinkBuilderFactory
LinkBuilder
pointing to the URI mapped to the given Method
assuming it was invoked on an
object of the given type.linkTo
in interface MethodLinkBuilderFactory<ControllerLinkBuilder>
controller
- must not be null.method
- must not be null.public ControllerLinkBuilder linkTo(Object invocationValue)
MethodLinkBuilderFactory
LinkBuilder
pointing to the URI mapped to the method the result is handed into this method. Use
DummyInvocationUtils.methodOn(Class, Object...)
to obtain a dummy instance of a controller to record a
dummy method invocation on. See ControllerLinkBuilder.linkTo(Object)
for an example.linkTo
in interface MethodLinkBuilderFactory<ControllerLinkBuilder>
invocationValue
- must not be null.ControllerLinkBuilder.linkTo(Object)
public ControllerLinkBuilder linkTo(Method method, Object... parameters)
MethodLinkBuilderFactory
LinkBuilder
pointing to the URI mapped to the given Method
and expanding this mapping
using the given parameters.linkTo
in interface MethodLinkBuilderFactory<ControllerLinkBuilder>
method
- must not be null.protected UriComponentsBuilder applyUriComponentsContributer(UriComponentsBuilder builder, DummyInvocationUtils.MethodInvocation invocation)
UriComponentsContributor
s to the given UriComponentsBuilder
.builder
- will never be null.invocation
- will never be null.Copyright © 2012-2016–2018 Pivotal, Inc.. All rights reserved.