Class ControllerLinkRelationProvider
java.lang.Object
org.springframework.hateoas.server.mvc.ControllerLinkRelationProvider
- All Implemented Interfaces:
LinkRelationProvider,org.springframework.plugin.core.Plugin<LinkRelationProvider.LookupContext>
LinkRelationProvider inspecting ExposesResourceFor annotations on controller classes.- Author:
- Oliver Drotbohm
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.hateoas.server.LinkRelationProvider
LinkRelationProvider.LookupContext -
Constructor Summary
ConstructorsConstructorDescriptionControllerLinkRelationProvider(Class<?> controller, org.springframework.plugin.core.PluginRegistry<LinkRelationProvider, LinkRelationProvider.LookupContext> providers) Creates a newControllerLinkRelationProvider -
Method Summary
Modifier and TypeMethodDescriptiongetCollectionResourceRelFor(Class<?> resource) Returns the relation type to be used to point to a collection resource of the given type.getItemResourceRelFor(Class<?> resource) Returns the relation type to be used to point to an item resource of the given type.booleanCallback method to manually selectLinkRelationProviderimplementations based on a givenLinkRelationProvider.LookupContext.
-
Constructor Details
-
ControllerLinkRelationProvider
public ControllerLinkRelationProvider(Class<?> controller, org.springframework.plugin.core.PluginRegistry<LinkRelationProvider, LinkRelationProvider.LookupContext> providers) Creates a newControllerLinkRelationProvider- Parameters:
controller- must not be null.providers- must not be null.
-
-
Method Details
-
getItemResourceRelFor
Description copied from interface:LinkRelationProviderReturns the relation type to be used to point to an item resource of the given type.- Specified by:
getItemResourceRelForin interfaceLinkRelationProvider- Parameters:
resource- must not be null.- Returns:
-
getCollectionResourceRelFor
Description copied from interface:LinkRelationProviderReturns the relation type to be used to point to a collection resource of the given type.- Specified by:
getCollectionResourceRelForin interfaceLinkRelationProvider- Parameters:
resource- must not be null.- Returns:
-
supports
Description copied from interface:LinkRelationProviderCallback method to manually selectLinkRelationProviderimplementations based on a givenLinkRelationProvider.LookupContext. User code shouldn't need to call this method explicitly but rather useDelegatingLinkRelationProvider, equip that with a set ofLinkRelationProviderimplementations as that will perform the selection of the matching one on invocations ofLinkRelationProvider.getItemResourceRelFor(Class)andLinkRelationProvider.getCollectionResourceRelFor(Class)transparently.- Specified by:
supportsin interfaceLinkRelationProvider- Specified by:
supportsin interfaceorg.springframework.plugin.core.Plugin<LinkRelationProvider.LookupContext>- See Also:
-
Plugin.supports(java.lang.Object)
-