citysdk.tourism.client.requests.uri
Class UriTemplate

java.lang.Object
  extended by citysdk.tourism.client.requests.uri.UriTemplate

public class UriTemplate
extends java.lang.Object

A simplified implementation of the URI Template (RFC6570) used to build the server URIs.

Author:
Pedro Cruz

Method Summary
 java.lang.String build()
          Builds the desired URI.
static UriTemplate fromTemplate(java.lang.String template)
          Generate a UriTemplate with a given template form.
 boolean hasParameter(java.lang.String name)
          Checks whether the URI contains the given name in the templated area.
 UriTemplate set(java.lang.String name, java.lang.Object value)
          Set the values of each template
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromTemplate

public static UriTemplate fromTemplate(java.lang.String template)
Generate a UriTemplate with a given template form.

Parameters:
template - the wanted template
Returns:
UriTemplate

set

public UriTemplate set(java.lang.String name,
                       java.lang.Object value)
Set the values of each template

Parameters:
name - the name of the template
value - the value of the template. Supported objects: simple objects that implement toString() method, Collections and Maps.
Returns:
a UriTemplate

hasParameter

public boolean hasParameter(java.lang.String name)
Checks whether the URI contains the given name in the templated area. This method is case sensitive.

Parameters:
name - the name to find
Returns:
true if the templated area contains the name, false otherwise

build

public java.lang.String build()
Builds the desired URI. This method resets previously set values.

Returns:
a String containing the expanded URI Template into a URI