public interface EntityLinks extends org.springframework.plugin.core.Plugin<Class<?>>
IllegalArgumentException
potentially
thrown by the declared methods will only appear if the #supports(Class)
method has returned false
and the method has been invoked anyway, i.e. if #supports(Class)
returns true it's safe to invoke
the interface methods an the exception will never be thrown.Modifier and Type | Method and Description |
---|---|
default <T> TypedEntityLinks.ExtendedTypedEntityLinks<T> |
forType(Class<T> type,
Function<T,Object> extractor)
Creates a
TypedEntityLinks instance using the given type and identifier extractor function. |
default <T> TypedEntityLinks<T> |
forType(Function<T,? extends Object> extractor)
Creates a
TypedEntityLinks instance using the given identifier extractor function. |
LinkBuilder |
linkFor(Class<?> type)
Returns a
LinkBuilder able to create links to the controller managing the given entity type. |
LinkBuilder |
linkFor(Class<?> type,
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. |
LinkBuilder |
linkForItemResource(Class<?> type,
Object id)
Returns a
LinkBuilder able to create links to the controller managing the given entity type and id. |
default <T> LinkBuilder |
linkForItemResource(T entity,
Function<T,Object> identifierExtractor)
Returns a
LinkBuilder able to create links to the controller managing the given entity type and identifier
extractor. |
Link |
linkToCollectionResource(Class<?> type)
Creates a
Link pointing to the collection resource of the given type. |
Link |
linkToItemResource(Class<?> type,
Object id)
Creates a
Link pointing to item resource backing the given entity type and id. |
default <T> Link |
linkToItemResource(T entity,
Function<T,Object> identifierExtractor)
Creates a
Link pointing to item resource backing the given entity and identifier extractor. |
LinkBuilder linkFor(Class<?> type)
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).type
- the entity type to point to, must not be null.LinkBuilder
pointing to the collection resource. Will never be null.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.LinkBuilder linkFor(Class<?> type, Object... parameters)
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.type
- the entity type to point to, must not be null.LinkBuilder
pointing to the collection resource.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.LinkBuilder linkForItemResource(Class<?> type, Object id)
LinkBuilder
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.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.LinkBuilder
pointing to the item resource identified by the given type and id. Will never be
null.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.default <T> LinkBuilder linkForItemResource(T entity, Function<T,Object> identifierExtractor)
LinkBuilder
able to create links to the controller managing the given entity type and identifier
extractor. Implementations will know about the URI structure being used to expose item-resource URIs.type
- the entity to point to, must not be null.identifierExtractor
- an extractor function to determine the id of the given entity, must not be
null.LinkBuilder
pointing to the item resource identified by the given entity. Will never be
null.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.Link linkToCollectionResource(Class<?> type)
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 IanaLinkRelations.SELF
.type
- 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.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.Link linkToItemResource(Class<?> type, Object id)
Link
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 to IanaLinkRelations.SELF
.type
- 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.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.default <T> Link linkToItemResource(T entity, Function<T,Object> identifierExtractor)
Link
pointing to item resource backing the given entity and identifier extractor. The relation
type of the link will be determined by the implementation class and should be defaulted to
IanaLinkRelations.SELF
.type
- the entity to point to, must not be null.identifierExtractor
- an extractor function to determine the id of the given entity.Link
pointing to the resource exposed for the given entity. Will never be null.IllegalArgumentException
- in case the given type is unknown the entity links infrastructure.default <T> TypedEntityLinks<T> forType(Function<T,? extends Object> extractor)
TypedEntityLinks
instance using the given identifier extractor function.T
- the type of entity to be handled.extractor
- the extractor to use to derive an identifier from the given entity.default <T> TypedEntityLinks.ExtendedTypedEntityLinks<T> forType(Class<T> type, Function<T,Object> extractor)
TypedEntityLinks
instance using the given type and identifier extractor function.T
- the type of entity to be handled.type
- the type of entity.extractor
- the extractor to use to derive an identifier from the given entity.Copyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.