net.netheos.pcsapi.utils
Class URIBuilder

java.lang.Object
  extended by net.netheos.pcsapi.utils.URIBuilder

public class URIBuilder
extends Object


Constructor Summary
URIBuilder(URI baseURI)
           
 
Method Summary
 URIBuilder addNullParameter(String key)
          Add a null query parameter (without any value).
 URIBuilder addParameter(String key, String value)
          Add a single query parameter.
 URI build()
          Build the URI with the given informations
 URIBuilder encodedPath(String encodedPath)
          Add an already escaped encodedPath part.
 URIBuilder queryParameters(Map<String,String> queryParams)
          Set the query parameters
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URIBuilder

public URIBuilder(URI baseURI)
Parameters:
baseURI - should NOT contain any query
Method Detail

encodedPath

public final URIBuilder encodedPath(String encodedPath)
Add an already escaped encodedPath part. This object takes cares of slash separators between successive calls to this method (but it does not de-duplicates slashs in given argument).

Parameters:
encodedPath - The url encoded encodedPath (may contain slashs)
Returns:
This builder

queryParameters

public URIBuilder queryParameters(Map<String,String> queryParams)
Set the query parameters

Parameters:
queryParams - The parameters to use in the URI (not url encoded)
Returns:
The builder

addNullParameter

public URIBuilder addNullParameter(String key)
Add a null query parameter (without any value). This will create a query string like : "key" (without '=' sign)

Parameters:
key - The parameter key (not url encoded)
Returns:
The builder

addParameter

public URIBuilder addParameter(String key,
                               String value)
Add a single query parameter. Parameter is ignored if it has null value.

Parameters:
key - The parameter key (not url encoded)
value - The parameter value (not url encoded)
Returns:
The builder

toString

public String toString()
Overrides:
toString in class Object

build

public URI build()
Build the URI with the given informations

Returns:
The URI


Copyright © 2014. All Rights Reserved.