|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.gwtutils.client.net.UrlBuilder
public final class UrlBuilder
Constructs a URL from a base URL and parameters.
Constructor Summary | |
---|---|
UrlBuilder(String baseUrl)
Creates a new UrlBuilder with the specified base URL. |
|
UrlBuilder(UrlBuilder urlBuilder)
Creates a copy of the specified UrlBuilder . |
Method Summary | |
---|---|
UrlBuilder |
addParam(String name,
double value)
Adds the specified double parameter to the URL. |
UrlBuilder |
addParam(String name,
int value)
Adds the specified integer parameter to the URL. |
UrlBuilder |
addParam(String name,
Object value)
Adds the specified parameter to the URL. |
UrlBuilder |
addParams(Map<String,? extends Object> parameters)
Adds all the specified parameters to the URL. |
String |
getUrl()
Returns the built URL. |
String |
toString()
Returns the URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UrlBuilder(String baseUrl)
UrlBuilder
with the specified base URL.
public UrlBuilder(UrlBuilder urlBuilder)
UrlBuilder
. This is useful if you
will be creating many URLs which share some of the parameters.
Method Detail |
---|
public UrlBuilder addParam(String name, Object value)
name
- The name of the URL parameter. May not be null
or an empty string.value
- The value of the URL parameter. Converted to a
String
by invoking toString
on it. May be
null
, in which case only the parameter name is appended
(no "=" is appended).
public UrlBuilder addParam(String name, int value)
name
- The name of the URL parameter. May not be null
or an empty string.value
- The value of the URL parameter. Converted to a
String
via String.valueOf(int)
.
public UrlBuilder addParam(String name, double value)
name
- The name of the URL parameter. May not be null
or an empty string.value
- The value of the URL parameter. Converted to a
String
via String.valueOf(double)
.
public UrlBuilder addParams(Map<String,? extends Object> parameters)
parameters
- A map from parameter names to parameter values.public String getUrl()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |