Class TypedEntityLinks<T>

java.lang.Object
org.springframework.hateoas.server.TypedEntityLinks<T>
Direct Known Subclasses:
TypedEntityLinks.ExtendedTypedEntityLinks

public class TypedEntityLinks<T> extends Object
Entity links API to create Links and LinkBuilder instances based on an identifier function.
Author:
Oliver Drotbohm
See Also:
  • Method Details

    • linkForItemResource

      public LinkBuilder linkForItemResource(T entity)
      Returns a LinkBuilder able to create links to the controller managing the given entity. Implementations will know about the URI structure being used to expose item-resource URIs.
      Parameters:
      entity - the entity to point to, must not be null.
      Returns:
      the LinkBuilder pointing to the item resource identified by the given entity. Will never be null.
      Throws:
      IllegalArgumentException - in case the given type is unknown the entity links infrastructure.
    • linkToItemResource

      public Link linkToItemResource(T entity)
      Creates a Link pointing to item resource backing the given entity. The relation type of the link will be determined by the implementation class and should be defaulted to IanaLinkRelations.SELF.
      Parameters:
      entity - the entity to point to, must not be null.
      Returns:
      the Link pointing to the resource exposed for the given entity. Will never be null.
      Throws:
      IllegalArgumentException - in case the given type is unknown the entity links infrastructure.