public class UriTemplate extends Object implements Iterable<TemplateVariable>, Serializable
http://tools.ietf.org/html/rfc6570,
Serialized Form| Constructor 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
TemplateVariables 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(TemplateVariable variable)
Creates a new
UriTemplate with the given TemplateVariable added. |
UriTemplate |
with(TemplateVariables variables)
Creates a new
UriTemplate with the current TemplateVariables augmented with the given ones. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic 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 - must not be null.public UriTemplate with(TemplateVariables variables)
UriTemplate with the current TemplateVariables augmented with the given ones.variables - must not be null.public UriTemplate with(TemplateVariable variable)
UriTemplate with the given TemplateVariable added.variable - must not 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()
TemplateVariables 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-2019–2019 Pivotal, Inc.. All rights reserved.