public class LinkBuilderImpl extends Object implements Link.Builder
Modifier and Type | Field and Description |
---|---|
protected URI |
baseUri |
protected Map<String,String> |
map
A map for all the link parameters such as "rel", "type", etc.
|
protected UriBuilder |
uriBuilder |
Constructor and Description |
---|
LinkBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
Link.Builder |
baseUri(String uri)
Set the base URI as a string for resolution of relative URIs.
|
Link.Builder |
baseUri(URI uri)
Set the base URI for resolution of relative URIs.
|
Link |
build(Object... values)
Finish building this link using the supplied values as URI parameters.
|
Link |
buildRelativized(URI uri,
Object... values)
Finish building this link using the supplied values as URI parameters
and relativize the result with respect to the supplied URI.
|
Link.Builder |
link(Link link)
Initialize builder using another link.
|
Link.Builder |
link(String link)
Initialize builder using another link represented as a string.
|
Link.Builder |
param(String name,
String value)
Set an arbitrary parameter on this link.
|
Link.Builder |
rel(String rel)
Convenience method to set a link relation.
|
Link.Builder |
title(String title)
Convenience method to set a
title on this link. |
Link.Builder |
type(String type)
Convenience method to set a
type on this link. |
Link.Builder |
uri(String uri)
Set underlying string representing URI template for the link being constructed.
|
Link.Builder |
uri(URI uri)
Set underlying URI template for the link being constructed.
|
Link.Builder |
uriBuilder(UriBuilder uriBuilder)
Set underlying URI builder representing the URI template for the link being constructed.
|
protected final Map<String,String> map
protected UriBuilder uriBuilder
protected URI baseUri
public Link.Builder link(Link link)
Link.Builder
link
in interface Link.Builder
link
- other link from which to initialize.public Link.Builder link(String link)
Link.Builder
link ::= '<' uri '>' (';' link-param)* link-param ::= name '=' quoted-stringSee RFC 5988 for more information.
link
in interface Link.Builder
link
- other link in string representation.public Link.Builder uriBuilder(UriBuilder uriBuilder)
Link.Builder
uriBuilder
in interface Link.Builder
uriBuilder
- underlying URI builder.public Link.Builder uri(URI uri)
Link.Builder
uri
in interface Link.Builder
uri
- underlying URI for linkpublic Link.Builder uri(String uri) throws IllegalArgumentException
Link.Builder
uri
in interface Link.Builder
uri
- underlying URI for link.IllegalArgumentException
- if string representation of URI is invalid.public Link.Builder rel(String rel)
Link.Builder
rel
value can
be specified by using one or more whitespace characters as delimiters
according to RFC 5988. The effect of calling this method is cumulative;
relations are appended using a single space character as separator.rel
in interface Link.Builder
rel
- relation name.public Link.Builder title(String title)
Link.Builder
title
on this link.title
in interface Link.Builder
title
- title parameter of this link.public Link.Builder type(String type)
Link.Builder
type
on this link.type
in interface Link.Builder
type
- type parameter of this link.public Link.Builder param(String name, String value) throws IllegalArgumentException
Link.Builder
Link.Builder.build(Object...)
.param
in interface Link.Builder
name
- the name of the parameter.value
- the value set for the parameter.IllegalArgumentException
- if either the name or value are null
.public Link build(Object... values) throws UriBuilderException
Link.Builder
build
in interface Link.Builder
values
- parameters used to build underlying URI.UriBuilderException
- if a URI cannot be constructed based on the
current state of the underlying URI builder.public Link buildRelativized(URI uri, Object... values)
Link.Builder
Link.Builder.build(java.lang.Object[])
. Note that a base URI can
be set on a relative link using Link.Builder.baseUri(java.net.URI)
.
The state of the builder is unaffected; this method may be called
multiple times on the same builder instance.buildRelativized
in interface Link.Builder
uri
- URI used for relativization.values
- parameters used to build underlying URI.Link.Builder.baseUri(java.lang.String)
,
Link.Builder.baseUri(java.net.URI)
public Link.Builder baseUri(URI uri)
Link.Builder
baseUri
in interface Link.Builder
uri
- base URI for relative links.Link.fromPath(java.lang.String)
,
Link.fromResource(java.lang.Class)
,
Link.fromMethod(java.lang.Class, java.lang.String)
public Link.Builder baseUri(String uri)
Link.Builder
baseUri
in interface Link.Builder
uri
- base URI for relative links.Link.fromPath(java.lang.String)
,
Link.fromResource(java.lang.Class)
,
Link.fromMethod(java.lang.Class, java.lang.String)
Copyright © 2019 JBoss by Red Hat. All rights reserved.