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
LinkBuilder
s based on a Spring MVC UriComponentsBuilder
.- Author:
- Ricardo Gladwell, Oliver Gierke, Kamill Sokol, Kevin Conaway, Greg Turnquist
-
Constructor Summary
ModifierConstructorDescriptionprotected
LinkBuilderSupport
(UriComponents builder) Creates a newLinkBuilderSupport
using the givenUriComponents
.protected
LinkBuilderSupport
(UriComponents components, List<Affordance> affordances) -
Method Summary
Modifier and TypeMethodDescriptionaddAffordances
(Collection<Affordance> affordances) protected abstract T
createNewInstance
(UriComponents components, List<Affordance> affordances) Creates a new instance of the sub-class.protected abstract T
getThis()
Returns the current concrete instance.Adds the given object'sString
representation as sub-resource to the current URI.protected T
slash
(UriComponents components, boolean encoded) toString()
toUri()
Creates a URI of the link built by the current builder instance.withRel
(LinkRelation rel) Creates theLink
built by the current builder instance with the givenLinkRelation
.Creates theLink
built by the current builder instance with the default self link relation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.hateoas.server.LinkBuilder
withRel
-
Constructor Details
-
LinkBuilderSupport
Creates a newLinkBuilderSupport
using the givenUriComponents
.- Parameters:
builder
- must not be null.
-
LinkBuilderSupport
-
-
Method Details
-
slash
Description copied from interface:LinkBuilder
Adds the given object'sString
representation as sub-resource to the current URI.- Specified by:
slash
in interfaceLinkBuilder
- Parameters:
object
- can be null.- Returns:
-
slash
-
toUri
Description copied from interface:LinkBuilder
Creates a URI of the link built by the current builder instance.- Specified by:
toUri
in interfaceLinkBuilder
- Returns:
-
addAffordances
-
withRel
Description copied from interface:LinkBuilder
Creates theLink
built by the current builder instance with the givenLinkRelation
.- Specified by:
withRel
in interfaceLinkBuilder
- Parameters:
rel
- must not be null or empty.- Returns:
-
withSelfRel
Description copied from interface:LinkBuilder
Creates theLink
built by the current builder instance with the default self link relation.- Specified by:
withSelfRel
in interfaceLinkBuilder
- Returns:
- See Also:
-
toString
-
getThis
Returns the current concrete instance.- Returns:
-
createNewInstance
Creates a new instance of the sub-class. -
getAffordances
-