public class URITemplate extends Object implements Expandable
| Constructor and Description |
|---|
URITemplate(String template)
Creates a new URI Template instance.
|
URITemplate(String template,
TokenFactory factory)
Creates a new URI Template instance using the specified token factory.
|
| Modifier and Type | Method and Description |
|---|---|
static List<Token> |
digest(String template)
Returns the list of tokens corresponding to the specified URI template.
|
static List<Token> |
digest(String template,
TokenFactory factory)
Returns the list of tokens corresponding to the specified URI template.
|
boolean |
equals(Object o) |
String |
expand(Parameters parameters)
Expands the template to produce a URI as defined by the URI Template specifications.
|
static String |
expand(String template,
Parameters parameters)
Method provided for convenience.
|
int |
hashCode() |
protected List<Token> |
tokens()
Returns the underlying list of tokens.
|
String |
toString() |
public URITemplate(String template) throws IllegalArgumentException
template - A String following the URI template syntax.NullPointerException - If the specified template is null.URITemplateSyntaxException - If the string provided does not follow the proper syntax.IllegalArgumentExceptionpublic URITemplate(String template, TokenFactory factory) throws IllegalArgumentException
If the specified factory is null, the default is used.
template - A String following the URI template syntax.factory - A token factory in order to choose the URI template syntax to use.NullPointerException - If the specified template is null.URITemplateSyntaxException - If the string provided does not follow the proper syntax.IllegalArgumentExceptionpublic String expand(Parameters parameters)
expand in interface Expandableparameters - The list of variables and their values for substitution.public static String expand(String template, Parameters parameters)
return new URITemplate(template).expand(variables);
template - The URI template.parameters - The parameter values to use for substitution.public static List<Token> digest(String template) throws URITemplateSyntaxException
template - The URI template to digest.URITemplateSyntaxException - If the string cannot be parsed.public static List<Token> digest(String template, TokenFactory factory) throws URITemplateSyntaxException
template - The URI template to digest.URITemplateSyntaxException - If the string cannot be parsed.protected List<Token> tokens()
Copyright © 2014. All rights reserved.