public class UriTemplate extends Object implements Iterable<TemplateVariable>, Serializable
http://tools.ietf.org/html/rfc6570
,
Serialized FormConstructor and Description |
---|
UriTemplate(String template)
Creates a new
UriTemplate using the given template string. |
UriTemplate(String baseUri,
TemplateVariables variables)
Creates a new
UriTemplate from the given base URI and TemplateVariables . |
Modifier and Type | Method and Description |
---|---|
URI |
expand(Map<String,? extends Object> parameters)
Expands the
UriTemplate using the given parameters. |
URI |
expand(Object... parameters)
Expands the
UriTemplate using the given parameters. |
List<String> |
getVariableNames()
Returns the names of the variables discovered.
|
List<TemplateVariable> |
getVariables()
Returns the
TemplateVariable s discovered. |
static boolean |
isTemplate(String candidate)
Returns whether the given candidate is a URI template.
|
Iterator<TemplateVariable> |
iterator() |
String |
toString() |
UriTemplate |
with(String variableName,
TemplateVariable.VariableType type)
Creates a new
UriTemplate with a TemplateVariable with the given name and type added. |
UriTemplate |
with(TemplateVariables variables)
Creates a new
UriTemplate with the current TemplateVariable s augmented with the given ones. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public UriTemplate(String template)
UriTemplate
using the given template string.template
- must not be null or empty.public UriTemplate(String baseUri, TemplateVariables variables)
UriTemplate
from the given base URI and TemplateVariables
.baseUri
- must not be null or empty.variables
- defaults to TemplateVariables.NONE
.public UriTemplate with(TemplateVariables variables)
UriTemplate
with the current TemplateVariable
s augmented with the given ones.variables
- can be null.public UriTemplate with(String variableName, TemplateVariable.VariableType type)
UriTemplate
with a TemplateVariable
with the given name and type added.variableName
- must not be null or empty.type
- must not be null.public static boolean isTemplate(String candidate)
candidate
- public List<TemplateVariable> getVariables()
TemplateVariable
s discovered.public List<String> getVariableNames()
public URI expand(Object... parameters)
UriTemplate
using the given parameters. The values will be applied in the order of the
variables discovered.parameters
- expand(Map)
public URI expand(Map<String,? extends Object> parameters)
UriTemplate
using the given parameters.parameters
- must not be null.public Iterator<TemplateVariable> iterator()
iterator
in interface Iterable<TemplateVariable>
Copyright © 2012-2015–2015 Pivotal, Inc.. All rights reserved.