UrlBuilder Class
- java.
lang. Object - com.
azure. core. util. UrlBuilder
- com.
public final class UrlBuilder
A builder class that is used to create URLs.
Constructor Summary
| Constructor | Description |
|---|---|
| UrlBuilder() |
Creates a new instance of UrlBuilder. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Url |
addQueryParameter(String queryParameterName, String queryParameterEncodedValue)
Append the provided query parameter name and encoded value to query string for the final URL. |
|
Url |
clearQuery()
Clear the query that will be used to build the final URL. |
| String |
getHost()
Get the host that has been assigned to this Url |
| String |
getPath()
Get the path that has been assigned to this Url |
| Integer |
getPort()
Get the port that has been assigned to this Url |
| Map<String,String> |
getQuery()
Get a view of the query that has been assigned to this Url |
| String |
getQueryString()
Returns the query string currently configured in this Url |
| String |
getScheme()
Get the scheme/protocol that has been assigned to this Url |
|
static
Url |
parse(String url)
Parses the passed |
|
static
Url |
parse(URL url)
Parse a Url |
|
Url |
setHost(String host)
Set the host that will be used to build the final URL. |
|
Url |
setPath(String path)
Set the path that will be used to build the final URL. |
|
Url |
setPort(int port)
Set the port that will be used to build the final URL. |
|
Url |
setPort(String port)
Set the port that will be used to build the final URL. |
|
Url |
setQuery(String query)
Set the query that will be used to build the final URL. |
|
Url |
setQueryParameter(String queryParameterName, String queryParameterEncodedValue)
Set the provided query parameter name and encoded value to query string for the final URL. |
|
Url |
setScheme(String scheme)
Set the scheme/protocol that will be used to build the final URL. |
| String |
toString()
Get the string representation of the URL that is being built. |
| URL |
toUrl()
Get the URL that is being built. |
Methods inherited from java.lang.Object
Constructor Details
UrlBuilder
public UrlBuilder()
Creates a new instance of UrlBuilder.
Method Details
addQueryParameter
public UrlBuilder addQueryParameter(String queryParameterName, String queryParameterEncodedValue)
Append the provided query parameter name and encoded value to query string for the final URL.
Parameters:
Returns:
clearQuery
public UrlBuilder clearQuery()
Clear the query that will be used to build the final URL.
Returns:
getHost
public String getHost()
Get the host that has been assigned to this UrlBuilder.
Returns:
getPath
public String getPath()
Get the path that has been assigned to this UrlBuilder.
Returns:
getPort
public Integer getPort()
Get the port that has been assigned to this UrlBuilder.
Returns:
getQuery
public Map<String,String> getQuery()
Get a view of the query that has been assigned to this UrlBuilder.
Changes to the Map returned by this API won't be reflected in the UrlBuilder.
Returns:
getQueryString
public String getQueryString()
Returns the query string currently configured in this UrlBuilder instance.
Returns:
getScheme
public String getScheme()
Get the scheme/protocol that has been assigned to this UrlBuilder.
Returns:
parse
public static UrlBuilder parse(String url)
Parses the passed url string into a UrlBuilder.
Parameters:
Returns:
parse
public static UrlBuilder parse(URL url)
Parse a UrlBuilder from the provided URL object.
Parameters:
Returns:
setHost
public UrlBuilder setHost(String host)
Set the host that will be used to build the final URL.
Parameters:
Returns:
setPath
public UrlBuilder setPath(String path)
Set the path that will be used to build the final URL.
Parameters:
Returns:
setPort
public UrlBuilder setPort(int port)
Set the port that will be used to build the final URL.
Parameters:
Returns:
setPort
public UrlBuilder setPort(String port)
Set the port that will be used to build the final URL.
Parameters:
Returns:
setQuery
public UrlBuilder setQuery(String query)
Set the query that will be used to build the final URL.
Parameters:
Returns:
setQueryParameter
public UrlBuilder setQueryParameter(String queryParameterName, String queryParameterEncodedValue)
Set the provided query parameter name and encoded value to query string for the final URL.
Parameters:
Returns:
setScheme
public UrlBuilder setScheme(String scheme)
Set the scheme/protocol that will be used to build the final URL.
Parameters:
Returns:
toString
public String toString()
Get the string representation of the URL that is being built.
Overrides:
UrlBuilder.toString()Returns:
toUrl
public URL toUrl()
Get the URL that is being built.
Returns:
Throws: