public abstract class LinkBuilderSupport<T extends LinkBuilder> extends Object implements LinkBuilder
LinkBuilders based on a Spring MVC UriComponentsBuilder.| Constructor and Description |
|---|
LinkBuilderSupport(org.springframework.web.util.UriComponents uriComponents)
Creates a new
LinkBuilderSupport using the given UriComponents. |
LinkBuilderSupport(org.springframework.web.util.UriComponentsBuilder builder)
Creates a new
LinkBuilderSupport using the given UriComponentsBuilder. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
createNewInstance(org.springframework.web.util.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. |
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.
|
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(org.springframework.web.util.UriComponentsBuilder builder)
LinkBuilderSupport using the given UriComponentsBuilder.builder - must not be null.public LinkBuilderSupport(org.springframework.web.util.UriComponents uriComponents)
LinkBuilderSupport using the given UriComponents.uriComponents - 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 LinkBuilderprotected T slash(org.springframework.web.util.UriComponents components, boolean encoded)
public 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(org.springframework.web.util.UriComponentsBuilder builder)
builder - will never be null.Copyright © 2012-2016–2017 Pivotal, Inc.. All rights reserved.