Package nbbrd.io.http
Class URLQueryBuilder
java.lang.Object
nbbrd.io.http.URLQueryBuilder
- Author:
- Philippe Charles
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull URLbuild()Creates a new URL using the specified path and parameters.static @NonNull URLQueryBuilder@NonNull URLQueryBuilderAppends the specified parameter to the current URL.@NonNull URLQueryBuilderAppends the specified parameter to the current URL.@NonNull URLQueryBuilderAppends the specified path to the current URL.@NonNull URLQueryBuilderAppends the specified path to the current URL.toString()@NonNull URLQueryBuildertrailingSlash(boolean trailingSlash) Appends a trailing slash to the final URL.
-
Constructor Details
-
URLQueryBuilder
public URLQueryBuilder()
-
-
Method Details
-
of
-
trailingSlash
Appends a trailing slash to the final URL.- Parameters:
trailingSlash- specify if a trailing slash is required- Returns:
- this builder
- See Also:
-
path
Appends the specified path to the current URL.- Parameters:
path- a non-null path- Returns:
- this builder
- Throws:
NullPointerException- if path is null
-
path
Appends the specified path to the current URL.- Parameters:
path- a non-null path- Returns:
- this builder
- Throws:
NullPointerException- if path is null
-
param
@NonNull public @NonNull URLQueryBuilder param(@NonNull @NonNull String key, @NonNull @NonNull String value) Appends the specified parameter to the current URL.- Parameters:
key- a non-null keyvalue- a non-null value- Returns:
- this builder
- Throws:
NullPointerException- if key or value is null
-
param
Appends the specified parameter to the current URL.- Parameters:
key- a non-null key- Returns:
- this builder
- Throws:
NullPointerException- if key or value is null
-
toString
-
build
Creates a new URL using the specified path and parameters.- Returns:
- a new URL
- Throws:
MalformedURLException- if no protocol is specified, or an unknown protocol is found, or spec is null, or the parsed URL fails to comply with the specific syntax of the associated protocol.
-