Class DelegatingEntityLinks
java.lang.Object
org.springframework.hateoas.server.core.DelegatingEntityLinks
- All Implemented Interfaces:
EntityLinks
,org.springframework.plugin.core.Plugin<Class<?>>
EntityLinks
implementation that delegates to the EntityLinks
instances registered in the
PluginRegistry
given on instance creation.- Author:
- Oliver Gierke
-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingEntityLinks
(org.springframework.plugin.core.PluginRegistry<EntityLinks, Class<?>> plugins) Creates a newDelegatingEntityLinks
using the givenPluginRegistry
. -
Method Summary
Modifier and TypeMethodDescriptionReturns aLinkBuilder
able to create links to the controller managing the given entity type.Returns aLinkBuilder
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.linkForItemResource
(Class<?> type, Object id) Returns aLinkBuilder
able to create links to the controller managing the given entity type and id.linkToCollectionResource
(Class<?> type) Creates aLink
pointing to the collection resource of the given type.linkToItemResource
(Class<?> type, Object id) Creates aLink
pointing to item resource backing the given entity type and id.boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.hateoas.server.EntityLinks
forType, forType, linkForItemResource, linkToItemResource
-
Constructor Details
-
DelegatingEntityLinks
public DelegatingEntityLinks(org.springframework.plugin.core.PluginRegistry<EntityLinks, Class<?>> plugins) Creates a newDelegatingEntityLinks
using the givenPluginRegistry
.- Parameters:
plugins
- must not be null.
-
-
Method Details
-
linkFor
Description copied from interface:EntityLinks
Returns aLinkBuilder
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).- Specified by:
linkFor
in interfaceEntityLinks
- Parameters:
type
- the entity type to point to, must not be null.- Returns:
- the
LinkBuilder
pointing to the collection resource. Will never be null.
-
linkFor
Description copied from interface:EntityLinks
Returns aLinkBuilder
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.- Specified by:
linkFor
in interfaceEntityLinks
- Parameters:
type
- the entity type to point to, must not be null.- Returns:
- the
LinkBuilder
pointing to the collection resource.
-
linkToCollectionResource
Description copied from interface:EntityLinks
Creates aLink
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 toIanaLinkRelations.SELF
.- Specified by:
linkToCollectionResource
in interfaceEntityLinks
- Parameters:
type
- the entity type to point to, must not be null.- Returns:
- the
Link
pointing to the collection resource exposed for the given entity. Will never be null.
-
linkToItemResource
Description copied from interface:EntityLinks
Creates aLink
pointing to item 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 toIanaLinkRelations.SELF
.- Specified by:
linkToItemResource
in interfaceEntityLinks
- Parameters:
type
- the entity type to point to, must not be null.id
- the identifier of the entity of the given type- Returns:
- the
Link
pointing to the resource exposed for the entity with the given type and id. Will never be null.
-
linkForItemResource
Description copied from interface:EntityLinks
Returns aLinkBuilder
able to create links to the controller managing the given entity type and id. Implementations will know about the URI structure being used to expose item-resource URIs.- Specified by:
linkForItemResource
in interfaceEntityLinks
- Parameters:
type
- the entity type to point to, must not be null.id
- the id of the object of the handed type, must not be null.- Returns:
- the
LinkBuilder
pointing to the item resource identified by the given type and id. Will never be null.
-
supports
- Specified by:
supports
in interfaceorg.springframework.plugin.core.Plugin<Class<?>>
-