public abstract class LinkBuilderSupport<T extends LinkBuilder> extends Object implements LinkBuilder
LinkBuilders 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)
LinkBuilderString representation as sub-resource to the current URI. Will unwrap
Identifiables to their id value (see Identifiable.getId()).slash in interface LinkBuilderpublic T slash(Identifiable<?> identifyable)
LinkBuilderIdentifiable's id as sub-resource. Will simply return the LinkBuilder as is if the
given entity is null.slash in interface LinkBuilderpublic URI toUri()
LinkBuildertoUri in interface LinkBuilderpublic Link withRel(String rel)
LinkBuilderLink built by the current builder instance with the given rel.withRel in interface LinkBuilderrel - must not be null or empty.public Link withSelfRel()
LinkBuilderLink built by the current builder instance with the default self rel.withSelfRel in interface LinkBuilderLink.REL_SELFprotected abstract T getThis()
protected abstract T createNewInstance(UriComponentsBuilder builder)
builder - will never be null.Copyright © 2012-2015–2015 Pivotal, Inc.. All rights reserved.