public class URLBuilder extends Object
Modifier and Type | Field and Description |
---|---|
private String |
fragement
URL fragment.
|
private String |
host
Host for the URL.
|
private String |
password
Password in the URL.
|
private String |
path
URL path.
|
private Integer |
port
URL port number.
|
private List<Pair<String,String>> |
queryParams
Parameters in the query string.
|
private String |
scheme
URL schema (http, https, etc).
|
private String |
username
User name in the URL.
|
Constructor and Description |
---|
URLBuilder()
Constructor.
|
URLBuilder(String baseURL)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
buildQueryString()
Builds the query string for the URL.
|
String |
buildURL()
Builds a URL from the given data.
|
String |
getFragment()
Gets the URL fragment in its decoded form.
|
String |
getHost()
Gets the host component of the URL.
|
String |
getPassword()
Gets the user's password in the URL.
|
String |
getPath()
Gets the path component of the URL.
|
Integer |
getPort()
Gets the port component of the URL.
|
List<Pair<String,String>> |
getQueryParams()
Gets the query string parameters for the URL.
|
String |
getScheme()
Gets the URL scheme (http, https, etc).
|
String |
getUsername()
Gets the user name component of the URL.
|
void |
setFragment(String newFragment)
Sets the URL fragment in its decoded form.
|
void |
setHost(String newHost)
Sets the host component of the URL.
|
void |
setPassword(String newPassword)
Sets the user's password in the URL.
|
void |
setPath(String newPath)
Sets the path component of the URL.
|
void |
setPort(Integer newPort)
Sets the port component of the URL.
|
void |
setScheme(String newScheme)
Sets the URL scheme (http, https, etc).
|
void |
setUsername(String newUsername)
Sets the user name component of the URL.
|
private String fragement
public URLBuilder()
public URLBuilder(@Nonnull @NotEmpty String baseURL) throws MalformedURLException
baseURL
- URL to parse and use as basis for creating other URLsMalformedURLException
- thrown if the given base URL is not well formed@Nullable public String getFragment()
public void setFragment(@Nullable String newFragment)
newFragment
- URL fragment in its decoded form@Nullable public String getHost()
public void setHost(@Nullable String newHost)
newHost
- host component of the URL@Nullable public String getPassword()
public void setPassword(@Nullable String newPassword)
newPassword
- user's password in the URL@Nullable public String getPath()
public void setPath(@Nullable String newPath)
newPath
- path component of the URL@Nullable public Integer getPort()
public void setPort(@Nullable Integer newPort)
newPort
- port component of the URL@Nonnull public List<Pair<String,String>> getQueryParams()
@Nullable public String getScheme()
public void setScheme(@Nullable String newScheme)
newScheme
- URL scheme (http, https, etc)@Nullable public String getUsername()
public void setUsername(@Nullable String newUsername)
newUsername
- user name component of the URL@Nullable public String buildURL()
Copyright © 1999–2017. All rights reserved.