Class UriBuilder

java.lang.Object
co.yellowdog.platform.clients.web.uri.UriBuilder

public class UriBuilder extends Object
  • Method Details

    • fromBaseUri

      public static UriBuilder fromBaseUri(@NonNull @NonNull URI baseUri)
      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

      public static UriBuilder fromBaseUri(@NonNull @NonNull String baseUri)
      Create a new builder with the given base URI.
      Parameters:
      baseUri - the base URI
      Returns:
      the builder
    • encodedPath

      public UriBuilder encodedPath(@NonNull @NonNull String path)
      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

      public UriBuilder path(Object... segments)
      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

      public UriBuilder param(String name, Object... values)
      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 name
      values - the parameter values
      Returns:
      this builder
    • param

      public UriBuilder param(String name, Collection<?> values)
    • build

      public URI build()