com.google.api.client.http
Class UriTemplate
java.lang.Object
com.google.api.client.http.UriTemplate
public class UriTemplate
- extends Object
Expands URI Templates.
This Class supports Level 1 templates and all Level 4 composite templates as described in:
URI Template.
Specifically, for the variables:
var := "value"
list := ["red", "green", "blue"]
keys := [("semi", ";"),("dot", "."),("comma", ",")]
The following templates results in the following expansions:
{var} -> value
{list} -> red,green,blue
{list*} -> red,green,blue
{key} -> semi,%3B,dot,.,comma,%2C
{key*} -> semi=%3B,dot=.,comma=%2C
{+list} -> red,green,blue
{+list*} -> red,green,blue
{+key} -> semi,;,dot,.,comma,,
{+key*} -> semi=;,dot=.,comma=,
{#list} -> #red,green,blue
{#list*} -> #red,green,blue
{#key} -> #semi,;,dot,.,comma,,
{#key*} -> #semi=;,dot=.,comma=,
X{.list} -> X.red,green,blue
X{.list*} -> X.red.green.blue
X{.key} - > X.semi,%3B,dot,.,comma,%2C
X{.key*} -> X.semi=%3B.dot=..comma=%2C
{/list} -> /red,green,blue
{/list*} -> /red/green/blue
{/key} -> /semi,%3B,dot,.,comma,%2C
{/key*} -> /semi=%3B/dot=./comma=%2C
{;list} -> ;list=red,green,blue
{;list*} -> ;red;green;blue
{;key} -> ;keys=semi,%3B,dot,.,comma,%2C
{;key*} -> ;semi=%3B;dot=.;comma=%2C
{?list} -> ?list=red,green,blue
{?list*} -> ?red&green&blue
{?key} -> ?keys=semi,%3B,dot,.,comma,%2C
{?key*} -> ?semi=%3B&dot=.&comma=%2C
{&list} -> &list=red,green,blue
{&list*} -> &red&green&blue
{&key} -> &keys=semi,%3B,dot,.,comma,%2C
{&key*} -> &semi=%3B&dot=.&comma=%2C
- Since:
- 1.6
- Author:
- Ravi Mistry
Method Summary |
static String |
expand(String pathUri,
Object parameters,
boolean addUnusedParamsAsQueryParams)
Expands templates in a URI. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UriTemplate
public UriTemplate()
expand
public static String expand(String pathUri,
Object parameters,
boolean addUnusedParamsAsQueryParams)
- Expands templates in a URI.
Supports Level 1 templates and all Level 4 composite templates as described in:
URI Template.
- Parameters:
pathUri
- URI component. It may contain one or more sequences of the form "{name}", where
"name" must be a key in variableMapparameters
- an object with parameters designated by Key annotations. If the template has
no variable references, parameters may be null
.addUnusedParamsAsQueryParams
- If true then parameters that do not match the template are
appended to the expanded template as query parameters.
- Returns:
- The expanded template
- Since:
- 1.6
Copyright © 2011 Google. All Rights Reserved.