Class DefaultSelfLinkProvider
java.lang.Object
org.springframework.data.rest.core.support.DefaultSelfLinkProvider
- All Implemented Interfaces:
SelfLinkProvider
Default implementation of SelfLinkProvider that uses an
EntityLinks
instance to create self links. Considers
the configured EntityLookup
s to use the returned resource identifier to eventually create the link.- Since:
- 2.5
- Author:
- Oliver Gierke
-
Constructor Summary
ConstructorDescriptionDefaultSelfLinkProvider
(PersistentEntities entities, org.springframework.hateoas.server.EntityLinks entityLinks, List<? extends EntityLookup<?>> lookups, ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.hateoas.Link
createSelfLinkFor
(Class<?> type, Object reference) Returns the self link for the entity of the given type and the given reference.org.springframework.hateoas.Link
createSelfLinkFor
(Object instance) Returns the self link for the given entity instance.
-
Constructor Details
-
DefaultSelfLinkProvider
public DefaultSelfLinkProvider(PersistentEntities entities, org.springframework.hateoas.server.EntityLinks entityLinks, List<? extends EntityLookup<?>> lookups, ConversionService conversionService) - Parameters:
entities
- must not be null.entityLinks
- must not be null.lookups
- must not be null.
-
-
Method Details
-
createSelfLinkFor
Description copied from interface:SelfLinkProvider
Returns the self link for the given entity instance. Only call this with an actual entity instance. Otherwise, preferSelfLinkProvider.createSelfLinkFor(Class, Object)
.- Specified by:
createSelfLinkFor
in interfaceSelfLinkProvider
- Parameters:
instance
- must never be null.- Returns:
- will never be null.
- See Also:
-
createSelfLinkFor
Description copied from interface:SelfLinkProvider
Returns the self link for the entity of the given type and the given reference. The latter can be an instance of the former, an identifier value of the former or anything that can be converted into an identifier in the first place.- Specified by:
createSelfLinkFor
in interfaceSelfLinkProvider
- Parameters:
type
- must not be null.reference
- must not be null.- Returns:
- will never be null.
-