public abstract class LinkBuilderSupport<T extends LinkBuilder> extends Object implements LinkBuilder
LinkBuilder
s based on a Spring MVC UriComponentsBuilder
.Constructor and Description |
---|
LinkBuilderSupport(UriComponentsBuilder builder)
Creates a new
LinkBuilderSupport using the given UriComponentsBuilder . |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
createNewInstance(UriComponentsBuilder builder)
Creates a new instance of the sub-class.
|
protected abstract T |
getThis()
Returns the current concrete instance.
|
T |
slash(Identifiable<?> identifyable)
Adds the given
Identifiable 's id as sub-resource. |
T |
slash(Object object)
Adds the given object's
String representation as sub-resource to the current URI. |
String |
toString() |
URI |
toUri()
Creates a URI of the link built by the current builder instance.
|
Link |
withRel(String rel)
Creates the
Link built by the current builder instance with the given rel. |
Link |
withSelfRel()
Creates the
Link built by the current builder instance with the default self rel. |
public LinkBuilderSupport(UriComponentsBuilder builder)
LinkBuilderSupport
using the given UriComponentsBuilder
.builder
- must not be null.public T slash(Object object)
LinkBuilder
String
representation as sub-resource to the current URI. Will unwrap
Identifiable
s to their id value (see Identifiable.getId()
).slash
in interface LinkBuilder
public T slash(Identifiable<?> identifyable)
LinkBuilder
Identifiable
's id as sub-resource. Will simply return the LinkBuilder
as is if the
given entity is null.slash
in interface LinkBuilder
public URI toUri()
LinkBuilder
toUri
in interface LinkBuilder
public Link withRel(String rel)
LinkBuilder
Link
built by the current builder instance with the given rel.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 rel.withSelfRel
in interface LinkBuilder
Link.REL_SELF
protected abstract T getThis()
protected abstract T createNewInstance(UriComponentsBuilder builder)
builder
- will never be null.Copyright © 2012-2015–2015 Pivotal, Inc.. All rights reserved.