Class UriBuilder
java.lang.Object
co.yellowdog.platform.clients.web.uri.UriBuilder
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
encodedPath
(@NonNull String path) Append an encoded path to the URI.static UriBuilder
fromBaseUri
(@NonNull String baseUri) Create a new builder with the given base URI.static UriBuilder
fromBaseUri
(@NonNull URI baseUri) Create a new builder with the given base URI.Add a query parameter to the URI.param
(String name, Collection<?> values) Append unencoded path segments to the URI.
-
Method Details
-
fromBaseUri
Create a new builder with the given base URI.- Parameters:
baseUri
- the base URI- Returns:
- the builder
- Throws:
NullPointerException
- if the base URI is null
-
fromBaseUri
Create a new builder with the given base URI.- Parameters:
baseUri
- the base URI- Returns:
- the builder
-
encodedPath
Append an encoded path to the URI. The path will be prepended with a "/" separator if necessary.- Parameters:
path
- the path- Returns:
- this builder
-
path
Append unencoded path segments to the URI. Each will be prepended with a "/" separator if necessary.- Parameters:
segments
- the unencoded path segments- Returns:
- this builder
-
param
Add a query parameter to the URI.The name and value will be encoded.
The name must not be null or empty. Null or empty values will be silently ignored. If all values are null or empty, the parameter will be silently ignored.
Each query parameter will be appended with an "&" separator. The name and value will be separated with a "=". Multiple values will each be as separated parameters e.g. "foo=bar&foo=baz".
- Parameters:
name
- the parameter namevalues
- the parameter values- Returns:
- this builder
-
param
-
build
-