Class UriBuilder


  • public class UriBuilder
    extends Object
    A uri builder.
    Author:
    Charles Draper
    • Constructor Detail

      • UriBuilder

        public UriBuilder​(URI uri)
        Creates a new UriBuilder based on the given uri.
        Parameters:
        uri - the default uri
      • UriBuilder

        public UriBuilder​(String uri)
        Creates a new UriBuilder based on the given uri.
        Parameters:
        uri - the default uri
    • Method Detail

      • scheme

        public UriBuilder scheme​(String scheme)
        Sets the scheme.
        Parameters:
        scheme - the scheme to set
        Returns:
        this
      • host

        public UriBuilder host​(String host)
        Sets the host.
        Parameters:
        host - the host to set
        Returns:
        this
      • port

        public UriBuilder port​(int port)
        Sets the port.
        Parameters:
        port - the port to set
        Returns:
        this
      • path

        public UriBuilder path​(String path)
        Adds to the path.
        Parameters:
        path - the path to add
        Returns:
        this
      • queryParam

        public UriBuilder queryParam​(String name,
                                     Object... value)
        Adds query parameters to the uri.
        Parameters:
        name - the name of the query parameter
        value - the value(s) to add
        Returns:
        this
      • build

        public URI build()
        Builds the URI.
        Returns:
        the newly built uri