Class LinkBuilderSupport<T extends LinkBuilder>

java.lang.Object
org.springframework.hateoas.server.core.LinkBuilderSupport<T>
All Implemented Interfaces:
LinkBuilder
Direct Known Subclasses:
BasicLinkBuilder, TemplateVariableAwareLinkBuilderSupport

public abstract class LinkBuilderSupport<T extends LinkBuilder> extends Object implements LinkBuilder
Base class to implement LinkBuilders based on a Spring MVC UriComponentsBuilder.
Author:
Ricardo Gladwell, Oliver Gierke, Kamill Sokol, Kevin Conaway, Greg Turnquist
  • Constructor Details

  • Method Details

    • slash

      public T slash(@Nullable Object object)
      Description copied from interface: LinkBuilder
      Adds the given object's String representation as sub-resource to the current URI.
      Specified by:
      slash in interface LinkBuilder
      Parameters:
      object - can be null.
      Returns:
    • slash

      protected T slash(UriComponents components, boolean encoded)
    • toUri

      public URI toUri()
      Description copied from interface: LinkBuilder
      Creates a URI of the link built by the current builder instance.
      Specified by:
      toUri in interface LinkBuilder
      Returns:
    • addAffordances

      public T addAffordances(Collection<Affordance> affordances)
    • withRel

      public Link withRel(LinkRelation rel)
      Description copied from interface: LinkBuilder
      Creates the Link built by the current builder instance with the given LinkRelation.
      Specified by:
      withRel in interface LinkBuilder
      Parameters:
      rel - must not be null or empty.
      Returns:
    • withSelfRel

      public Link withSelfRel()
      Description copied from interface: LinkBuilder
      Creates the Link built by the current builder instance with the default self link relation.
      Specified by:
      withSelfRel in interface LinkBuilder
      Returns:
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getThis

      protected abstract T getThis()
      Returns the current concrete instance.
      Returns:
    • createNewInstance

      protected abstract T createNewInstance(UriComponents components, List<Affordance> affordances)
      Creates a new instance of the sub-class.
    • getAffordances

      public List<Affordance> getAffordances()