Class Scheme<SEGMENT,​QUERY extends Query<?>,​FRAGMENT extends Fragment<?>>

  • Type Parameters:
    SEGMENT - The type of Segment used by paths of this scheme.
    QUERY - The type of Query used by this scheme.
    FRAGMENT - The type of Fragment used by this scheme.
    Direct Known Subclasses:
    Scheme.GenericScheme, SchemeWithDefaultPort

    public abstract class Scheme<SEGMENT,​QUERY extends Query<?>,​FRAGMENT extends Fragment<?>>
    extends java.lang.Object
    A name component of a URI. Immutable and thread safe.
    See Also:
    RFC 3986 - Scheme
    • Method Detail

      • scheme

        public static Scheme<java.lang.String,​Query<java.lang.String>,​Fragment<java.lang.String>> scheme​(java.lang.String name)
        Factory method for creating Schemes. Schemes must be at least one character long, and are permitted to contain any character in the Latin alphabet, any digit, and any of the characters '+', '-', and '.'.
        Parameters:
        name - a String containing at least one character, made up of any characters in the Latin alphabet, the digits, and the characters '+', '-', and '.'.
        Returns:
        a Scheme representing the given String.
        Throws:
        java.lang.IllegalArgumentException - if the given String is empty or contains characters not in the Latin alphabet, the digits, or the characters '+', '-', and '.'.
      • scheme

        public static Scheme<java.lang.String,​Query<java.lang.String>,​Fragment<java.lang.String>> scheme​(java.lang.String name,
                                                                                                                     Port defaultPort)
        Factory method for creating Schemes that have a default port. Schemes must be at least one character long, and are permitted to contain any character in the Latin alphabet, any digit, and any of the characters '+', '-', and '.'.

        An example of a name that defines a default port is http, which defaults to port 80, meaning http://example.com is equivalent to, and preferred to http://example.com:80.

        Parameters:
        name - a String containing at least one character, made up of any characters in the Latin alphabet, the digits, and the characters '+', '-', and '.'.
        defaultPort - Port representing the default port for this name.
        Returns:
        a Scheme representing the given String, using the given default port.
        Throws:
        java.lang.IllegalArgumentException - if the given String is empty or contains characters not in the Latin alphabet, the digits, or the characters '+', '-', and '.'.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference()
        Factory method for creating RelativeReferences with just an empty path.
        Returns:
        a RelativeReference with an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority)
        Factory method for creating RelativeReferences with an authority and an empty path.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Path<SEGMENT> path)
        Factory method for creating RelativeReferences with just a path.
        Parameters:
        path - any Path to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             AbsolutePath<SEGMENT> path)
        Factory method for creating RelativeReferences with an authority and a path.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        path - any AbsolutePath to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority and Path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(QUERY query)
        Factory method for creating RelativeReferences with a query and an empty path.
        Parameters:
        query - any Query to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Query and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             QUERY query)
        Factory method for creating RelativeReferences with an authority, a query and an empty path.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        query - any Query to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority and Query, and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Path<SEGMENT> path,
                                                                                             QUERY query)
        Factory method for creating RelativeReferences with a path and a query.
        Parameters:
        path - any Path to use in this RelativeReference.
        query - any Query to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Path and Query.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             AbsolutePath<SEGMENT> path,
                                                                                             QUERY query)
        Factory method for creating RelativeReferences with an authority, a path, and a query.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        path - any Path to use in this RelativeReference.
        query - any Query to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority, Path and Query.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(FRAGMENT fragment)
        Factory method for creating RelativeReferences with a fragment and an empty path.
        Parameters:
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Fragment and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with an authority, a fragment, and an empty path.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority and Fragment, and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Path<SEGMENT> path,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with a path and a fragment.
        Parameters:
        path - any Path to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Path and Fragment.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             AbsolutePath<SEGMENT> path,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with an authority, a path, and fragment.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        path - any AbsolutePath to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority, Path and Fragment.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(QUERY query,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with a query, a fragment, and an empty path.
        Parameters:
        query - any Query to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Query and Fragment, and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             QUERY query,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with an authority, a query, a fragment, and an empty path.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        query - any Query to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority, Query and Fragment, and an empty path.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Path<SEGMENT> path,
                                                                                             QUERY query,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with a path, a query, and a fragment.
        Parameters:
        path - any Path to use in this RelativeReference.
        query - any Query to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Path, Query and Fragment.
      • relativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> relativeReference​(Authority authority,
                                                                                             AbsolutePath<SEGMENT> path,
                                                                                             QUERY query,
                                                                                             FRAGMENT fragment)
        Factory method for creating RelativeReferences with an authority, a path, a query, and a fragment.
        Parameters:
        authority - any Authority to use in this RelativeReference.
        path - any AbsolutePath to use in this RelativeReference.
        query - any Query to use in this RelativeReference.
        fragment - any Fragment to use in this RelativeReference.
        Returns:
        a RelativeReference with the given Authority, Path, Query and Fragment.
      • parseRelativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> parseRelativeReference​(java.lang.String relativeReferenceString)
                                                                                           throws ParseException
        Parses the given String as a relative reference.
        Parameters:
        relativeReferenceString - a String that represents a relative reference.
        Returns:
        a UrinReference representing the relative reference represented by the given String.
        Throws:
        ParseException - if the given String is not a valid relative reference.
      • parseRelativeReference

        public final RelativeReference<SEGMENT,​QUERY,​FRAGMENT> parseRelativeReference​(java.net.URI uri)
                                                                                           throws ParseException
        Parses the given URI to produce a RelativeReference.
        Parameters:
        uri - a URI representing a relative reference to parse.
        Returns:
        a RelativeReference representing the RFC 3986 relative reference represented by the given URI.
        Throws:
        ParseException - if the given URI is not a valid RFC 3986 relative reference.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin()
        Factory method for creating Urins with just a scheme and empty path.
        Returns:
        a Urin with the given Scheme and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Path<SEGMENT> path)
        Factory method for creating Urins with just scheme and path components.
        Parameters:
        path - any Path to use in this Urin.
        Returns:
        a Urin with the given Scheme and Path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority)
        Factory method for creating Urins with just scheme, authority, and empty path components.
        Parameters:
        authority - any Authority to use in this Urin.
        Returns:
        a Urin with the given Scheme and Authority, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   AbsolutePath<SEGMENT> path)
        Factory method for creating Urins with just scheme, authority, and path components.
        Parameters:
        authority - any Authority to use in this Urin.
        path - any AbsolutePath to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, and AbsolutePath.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(FRAGMENT fragment)
        Factory method for creating Urins with just a scheme, fragment, and empty path.
        Parameters:
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, the given Fragment, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Path<SEGMENT> path,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with just scheme, path, and fragment components.
        Parameters:
        path - any Path to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Fragment, and Path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with just scheme, authority, fragment, and empty path components.
        Parameters:
        authority - any Authority to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, and Fragment, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   AbsolutePath<SEGMENT> path,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with just scheme, authority, path, and fragment components.
        Parameters:
        authority - any Authority to use in this Urin.
        path - any AbsolutePath to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, AbsolutePath, and Fragment.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(QUERY query)
        Factory method for creating Urins with just a scheme, query, and empty path.
        Parameters:
        query - any Query to use in this Urin.
        Returns:
        a Urin with the given Scheme, the given Query, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Path<SEGMENT> path,
                                                                   QUERY query)
        Factory method for creating Urins with just scheme, path, and query components.
        Parameters:
        path - any Path to use in this Urin.
        query - any Query to use in this Urin.
        Returns:
        a Urin with the given Scheme, Query, and Path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   QUERY query)
        Factory method for creating Urins with just scheme, authority, query, and empty path components.
        Parameters:
        authority - any Authority to use in this Urin.
        query - any Query to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, and Query, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   AbsolutePath<SEGMENT> path,
                                                                   QUERY query)
        Factory method for creating Urins with just scheme, authority, path, and query components.
        Parameters:
        authority - any Authority to use in this Urin.
        path - any AbsolutePath to use in this Urin.
        query - any Query to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, AbsolutePath, and Query.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(QUERY query,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with scheme, empty path, query, and fragment components.
        Parameters:
        query - any Query to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Query, and Fragment, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Path<SEGMENT> path,
                                                                   QUERY query,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with scheme, path, query, and fragment components.
        Parameters:
        path - any Path to use in this Urin.
        query - any Query to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Path, Query, and Fragment.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   QUERY query,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with scheme, authority, empty path, query, and fragment components.
        Parameters:
        authority - any Authority to use in this Urin.
        query - any Query to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, Query, and Fragment, and an empty path.
      • urin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> urin​(Authority authority,
                                                                   AbsolutePath<SEGMENT> path,
                                                                   QUERY query,
                                                                   FRAGMENT fragment)
        Factory method for creating Urins with scheme, authority, path, query, and fragment components.
        Parameters:
        authority - any Authority to use in this Urin.
        path - any AbsolutePath to use in this Urin.
        query - any Query to use in this Urin.
        fragment - any Fragment to use in this Urin.
        Returns:
        a Urin with the given Scheme, Authority, AbsolutePath, Query, and Fragment.
      • parseUrin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> parseUrin​(java.lang.String uriString)
                                                                 throws ParseException
        Parses the given String as a URI.
        Parameters:
        uriString - a String that represents a URI.
        Returns:
        a Urin representing the URI represented by the given String.
        Throws:
        ParseException - if the given String is not a valid URI.
      • parseUrin

        public final Urin<SEGMENT,​QUERY,​FRAGMENT> parseUrin​(java.net.URI uri)
                                                                 throws ParseException
        Parses the given URI to produce a Urin.
        Parameters:
        uri - a URI to parse.
        Returns:
        a Urin representing the RFC 3986 URI represented by the given URI.
        Throws:
        ParseException - if the given URI is not a valid RFC 3986 URI.
      • parseUrinReference

        public final UrinReference<SEGMENT,​QUERY,​FRAGMENT> parseUrinReference​(java.lang.String uriReferenceString)
                                                                                   throws ParseException
        Parses the given String as a URI reference.
        Parameters:
        uriReferenceString - a String that represents a URI reference.
        Returns:
        a UrinReference representing the URI reference represented by the given String.
        Throws:
        ParseException - if the given String is not a valid URI reference.
      • parseUrinReference

        public final UrinReference<SEGMENT,​QUERY,​FRAGMENT> parseUrinReference​(java.net.URI uriReference)
                                                                                   throws ParseException
        Parses the given URI to produce a UrinReference.
        Parameters:
        uriReference - a URI to parse.
        Returns:
        a UrinReference representing the RFC 3986 URI reference represented by the given URI.
        Throws:
        ParseException - if the given URI is not a valid RFC 3986 URI reference.