public class ControllerEntityLinks extends AbstractEntityLinks
EntityLinks
implementation which assumes a certain URI mapping structure:
@RequestMapping(method = RequestMethod.GET)
in case of a Spring MVC controller.Constructor and Description |
---|
ControllerEntityLinks(Iterable<? extends Class<?>> controllerTypes,
LinkBuilderFactory<? extends LinkBuilder> linkBuilderFactory)
Creates a new
ControllerEntityLinks inspecting the configured classes for the given annotation. |
Modifier and Type | Method and Description |
---|---|
LinkBuilder |
linkFor(Class<?> entity)
Returns a
LinkBuilder able to create links to the controller managing the given entity type. |
LinkBuilder |
linkFor(Class<?> entity,
Object... parameters)
Returns a
LinkBuilder able to create links to the controller managing the given entity type, unfolding the
given parameters into the URI template the backing controller is mapped to. |
Link |
linkToCollectionResource(Class<?> entity)
Creates a
Link pointing to the collection resource of the given type. |
Link |
linkToSingleResource(Class<?> entity,
Object id)
Creates a
Link pointing to single resource backing the given entity type and id. |
boolean |
supports(Class<?> delimiter) |
linkForSingleResource, linkForSingleResource, linkToSingleResource
public ControllerEntityLinks(Iterable<? extends Class<?>> controllerTypes, LinkBuilderFactory<? extends LinkBuilder> linkBuilderFactory)
ControllerEntityLinks
inspecting the configured classes for the given annotation.controllerTypes
- the controller classes to be inspected.linkBuilderFactory
- the LinkBuilder
to use to create links.public LinkBuilder linkFor(Class<?> entity)
EntityLinks
LinkBuilder
able to create links to the controller managing the given entity type. Expects a
controller being mapped to a fully expanded URI template (i.e. not path variables being used).entity
- the entity type to point to, must not be null.LinkBuilder
pointing to the collection resource. Will never be null.public LinkBuilder linkFor(Class<?> entity, Object... parameters)
EntityLinks
LinkBuilder
able to create links to the controller managing the given entity type, unfolding the
given parameters into the URI template the backing controller is mapped to.entity
- the entity type to point to, must not be null.LinkBuilder
pointing to the collection resource.public Link linkToCollectionResource(Class<?> entity)
EntityLinks
Link
pointing to the collection resource of the given type. The relation type of the link will be
determined by the implementation class and should be defaulted to Link.REL_SELF
.entity
- the entity type to point to, must not be null.Link
pointing to the collection resource exposed for the given entity. Will never be
null.public Link linkToSingleResource(Class<?> entity, Object id)
EntityLinks
Link
pointing to single resource backing the given entity type and id. The relation type of the
link will be determined by the implementation class and should be defaulted to Link.REL_SELF
.entity
- the entity type to point to, must not be null.id
- the identifier of the entity of the given typeLink
pointing to the resource exposed for the entity with the given type and id. Will never be
null.public boolean supports(Class<?> delimiter)
Copyright © 2012-2016–2018 Pivotal, Inc.. All rights reserved.