Class WebMvcLinkBuilderFactory
java.lang.Object
org.springframework.hateoas.server.mvc.WebMvcLinkBuilderFactory
- All Implemented Interfaces:
LinkBuilderFactory<WebMvcLinkBuilder>
,MethodLinkBuilderFactory<WebMvcLinkBuilder>
public class WebMvcLinkBuilderFactory
extends Object
implements MethodLinkBuilderFactory<WebMvcLinkBuilder>
Factory for
LinkBuilderSupport
instances based on the request mapping annotated on the given controller.- Author:
- Ricardo Gladwell, Oliver Gierke, Dietrich Schulten, Kamill Sokol, Ross Turner, Oemer Yildiz, Kevin Conaway, Andrew Naydyonock, Greg Turnquist, RĂ©da Housni Alaoui
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newLinkBuilder
with a base of the mapping annotated to the given target class (controller, service, etc.).Creates a newLinkBuilder
with a base of the mapping annotated to the given target class (controller, service, etc.).Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
assuming it was invoked on an object of the given type expanding the mapping using null values as parameters.Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
assuming it was invoked on an object of the given type.Creates a newLinkBuilder
with a base of the mapping annotated to the given target class (controller, service, etc.).Returns aLinkBuilder
pointing to the URI mapped to the method the result is handed into this method.Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
and expanding this mapping using null values as parameters.Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
and expanding this mapping using the given parameters.void
setUriComponentsContributors
(List<? extends UriComponentsContributor> uriComponentsContributors) Configures theUriComponentsContributor
to be used when buildingLink
instances from method invocations.
-
Constructor Details
-
WebMvcLinkBuilderFactory
public WebMvcLinkBuilderFactory()
-
-
Method Details
-
setUriComponentsContributors
public void setUriComponentsContributors(List<? extends UriComponentsContributor> uriComponentsContributors) Configures theUriComponentsContributor
to be used when buildingLink
instances from method invocations.- Parameters:
uriComponentsContributors
- the uriComponentsContributors to set- See Also:
-
linkTo
Description copied from interface:LinkBuilderFactory
Creates a newLinkBuilder
with a base of the mapping annotated to the given target class (controller, service, etc.).- Specified by:
linkTo
in interfaceLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
controller
- must not be null.- Returns:
-
linkTo
Description copied from interface:LinkBuilderFactory
Creates a newLinkBuilder
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.- Specified by:
linkTo
in interfaceLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
controller
- must not be null.parameters
- must not be null.- Returns:
-
linkTo
Description copied from interface:LinkBuilderFactory
Creates a newLinkBuilder
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.- Specified by:
linkTo
in interfaceLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
controller
- must not be null.parameters
- must not be null.- Returns:
-
linkTo
Description copied from interface:MethodLinkBuilderFactory
Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
and expanding this mapping using null values as parameters.- Specified by:
linkTo
in interfaceMethodLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
method
- must not be null.- Returns:
-
linkTo
Description copied from interface:MethodLinkBuilderFactory
Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
and expanding this mapping using the given parameters. The number of parameter values has to match the length of the given method's expected parameters.- Specified by:
linkTo
in interfaceMethodLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
method
- must not be null.- Returns:
-
linkTo
Description copied from interface:MethodLinkBuilderFactory
Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
assuming it was invoked on an object of the given type expanding the mapping using null values as parameters.- Specified by:
linkTo
in interfaceMethodLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
type
- must not be null.method
- must not be null.- Returns:
-
linkTo
Description copied from interface:MethodLinkBuilderFactory
Returns aLinkBuilder
pointing to the URI mapped to the givenMethod
assuming it was invoked on an object of the given type. The number of parameter values has to match the length of the given method's expected parameters.- Specified by:
linkTo
in interfaceMethodLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
controller
- must not be null.method
- must not be null.- Returns:
-
linkTo
Description copied from interface:MethodLinkBuilderFactory
Returns aLinkBuilder
pointing to the URI mapped to the method the result is handed into this method. UseDummyInvocationUtils.methodOn(Class, Object...)
to obtain a dummy instance of a controller to record a dummy method invocation on. SeeWebMvcLinkBuilder.linkTo(Object)
for an example.- Specified by:
linkTo
in interfaceMethodLinkBuilderFactory<WebMvcLinkBuilder>
- Parameters:
invocationValue
- must not be null.- Returns:
- See Also:
-