public abstract class LinkBuilderSupport<T extends LinkBuilder> extends Object implements LinkBuilder
LinkBuilder
s based on a Spring MVC UriComponentsBuilder
.Modifier | Constructor and Description |
---|---|
protected |
LinkBuilderSupport(org.springframework.web.util.UriComponentsBuilder builder)
Creates a new
LinkBuilderSupport using the given UriComponents . |
protected |
LinkBuilderSupport(org.springframework.web.util.UriComponentsBuilder builder,
List<Affordance> affordances) |
protected |
LinkBuilderSupport(org.springframework.web.util.UriComponents components,
List<Affordance> affordances) |
Modifier and Type | Method and Description |
---|---|
T |
addAffordances(Collection<Affordance> affordances) |
protected abstract T |
createNewInstance(org.springframework.web.util.UriComponentsBuilder builder,
List<Affordance> affordances)
Creates a new instance of the sub-class.
|
protected abstract T |
getThis()
Returns the current concrete instance.
|
T |
slash(Object object)
Adds the given object's
String representation as sub-resource to the current URI. |
protected T |
slash(org.springframework.web.util.UriComponents components,
boolean encoded) |
String |
toString() |
URI |
toUri()
Creates a URI of the link built by the current builder instance.
|
protected <S> S |
withFreshBuilder(Function<org.springframework.web.util.UriComponentsBuilder,S> function)
Executes the given
Function using a freshly cloned UriComponentsBuilder . |
Link |
withRel(LinkRelation rel)
Creates the
Link built by the current builder instance with the given LinkRelation . |
Link |
withSelfRel()
Creates the
Link built by the current builder instance with the default self link relation. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
withRel
protected LinkBuilderSupport(org.springframework.web.util.UriComponentsBuilder builder)
LinkBuilderSupport
using the given UriComponents
.builder
- must not be null.protected LinkBuilderSupport(org.springframework.web.util.UriComponentsBuilder builder, List<Affordance> affordances)
protected LinkBuilderSupport(org.springframework.web.util.UriComponents components, List<Affordance> affordances)
public T slash(Object object)
LinkBuilder
String
representation as sub-resource to the current URI.slash
in interface LinkBuilder
protected T slash(org.springframework.web.util.UriComponents components, boolean encoded)
public URI toUri()
LinkBuilder
toUri
in interface LinkBuilder
public T addAffordances(Collection<Affordance> affordances)
public Link withRel(LinkRelation rel)
LinkBuilder
Link
built by the current builder instance with the given LinkRelation
.withRel
in interface LinkBuilder
rel
- must not be null or empty.public Link withSelfRel()
LinkBuilder
Link
built by the current builder instance with the default self link relation.withSelfRel
in interface LinkBuilder
IanaLinkRelations.SELF
protected <S> S withFreshBuilder(Function<org.springframework.web.util.UriComponentsBuilder,S> function)
Function
using a freshly cloned UriComponentsBuilder
.function
- must not be null.protected abstract T getThis()
protected abstract T createNewInstance(org.springframework.web.util.UriComponentsBuilder builder, List<Affordance> affordances)
builder
- will never be null.Copyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.