com.github.fge.uritemplate
Class URITemplate

java.lang.Object
  extended by com.github.fge.uritemplate.URITemplate

public final class URITemplate
extends Object

Main URI template class

See Also:
URITemplateParser

Constructor Summary
URITemplate(String input)
          Constructor
 
Method Summary
 String toString(VariableMap vars)
          Expand this template to a string given a list of variables
 URI toURI(VariableMap vars)
          Expand this template to a URI given a set of variables
 URL toURL(VariableMap vars)
          Expand this template to a URL given a set of variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URITemplate

public URITemplate(String input)
            throws URITemplateParseException
Constructor

Parameters:
input - the input string
Throws:
URITemplateParseException - parse error
Method Detail

toString

public String toString(VariableMap vars)
                throws URITemplateException
Expand this template to a string given a list of variables

Parameters:
vars - the variable map (names as keys, contents as values)
Returns:
expanded string
Throws:
URITemplateException - expansion error (f.e. modifier mismatch)

toURI

public URI toURI(VariableMap vars)
          throws URITemplateException,
                 URISyntaxException
Expand this template to a URI given a set of variables

Parameters:
vars - the variables
Returns:
a URI
Throws:
URITemplateException - see toString(VariableMap)
URISyntaxException - expanded string is not a valid URI

toURL

public URL toURL(VariableMap vars)
          throws URITemplateException,
                 MalformedURLException
Expand this template to a URL given a set of variables

Parameters:
vars - the variables
Returns:
a URL
Throws:
URITemplateException - see toString(VariableMap)
MalformedURLException - expanded string is not a valid URL