Module net.sourceforge.urin
Package net.sourceforge.urin
Class Scheme<SEGMENT,QUERY extends Query<?>,FRAGMENT extends Fragment<?>>
- java.lang.Object
-
- net.sourceforge.urin.Scheme<SEGMENT,QUERY,FRAGMENT>
-
- Type Parameters:
SEGMENT- The type ofSegmentused by paths of this scheme.QUERY- The type ofQueryused by this scheme.FRAGMENT- The type ofFragmentused by this scheme.
- Direct Known Subclasses:
Scheme.GenericScheme,SchemeWithDefaultPort
public abstract class Scheme<SEGMENT,QUERY extends Query<?>,FRAGMENT extends Fragment<?>> extends java.lang.ObjectA name component of a URI. Immutable and thread safe.- See Also:
- RFC 3986 - Scheme
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RelativeReference<SEGMENT,QUERY,FRAGMENT>parseRelativeReference(java.lang.String relativeReferenceString)Parses the givenStringas a relative reference.RelativeReference<SEGMENT,QUERY,FRAGMENT>parseRelativeReference(java.net.URI uri)Parses the givenURIto produce aRelativeReference.Urin<SEGMENT,QUERY,FRAGMENT>parseUrin(java.lang.String uriString)Parses the givenStringas a URI.Urin<SEGMENT,QUERY,FRAGMENT>parseUrin(java.net.URI uri)Parses the givenURIto produce aUrin.UrinReference<SEGMENT,QUERY,FRAGMENT>parseUrinReference(java.lang.String uriReferenceString)Parses the givenStringas a URI reference.UrinReference<SEGMENT,QUERY,FRAGMENT>parseUrinReference(java.net.URI uriReference)Parses the givenURIto produce aUrinReference.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference()Factory method for creatingRelativeReferences with just an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(FRAGMENT fragment)Factory method for creatingRelativeReferences with a fragment and an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority)Factory method for creatingRelativeReferences with an authority and an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, FRAGMENT fragment)Factory method for creatingRelativeReferences with an authority, a fragment, and an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, AbsolutePath<SEGMENT> path)Factory method for creatingRelativeReferences with an authority and a path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, AbsolutePath<SEGMENT> path, FRAGMENT fragment)Factory method for creatingRelativeReferences with an authority, a path, and fragment.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, AbsolutePath<SEGMENT> path, QUERY query)Factory method for creatingRelativeReferences with an authority, a path, and a query.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, AbsolutePath<SEGMENT> path, QUERY query, FRAGMENT fragment)Factory method for creatingRelativeReferences with an authority, a path, a query, and a fragment.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, QUERY query)Factory method for creatingRelativeReferences with an authority, a query and an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Authority authority, QUERY query, FRAGMENT fragment)Factory method for creatingRelativeReferences with an authority, a query, a fragment, and an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Path<SEGMENT> path)Factory method for creatingRelativeReferences with just a path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Path<SEGMENT> path, FRAGMENT fragment)Factory method for creatingRelativeReferences with a path and a fragment.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Path<SEGMENT> path, QUERY query)Factory method for creatingRelativeReferences with a path and a query.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(Path<SEGMENT> path, QUERY query, FRAGMENT fragment)Factory method for creatingRelativeReferences with a path, a query, and a fragment.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(QUERY query)Factory method for creatingRelativeReferences with a query and an empty path.RelativeReference<SEGMENT,QUERY,FRAGMENT>relativeReference(QUERY query, FRAGMENT fragment)Factory method for creatingRelativeReferences with a query, a fragment, and an empty path.static Scheme<java.lang.String,Query<java.lang.String>,Fragment<java.lang.String>>scheme(java.lang.String name)Factory method for creatingSchemes.static Scheme<java.lang.String,Query<java.lang.String>,Fragment<java.lang.String>>scheme(java.lang.String name, Port defaultPort)Factory method for creatingSchemes that have a default port.Urin<SEGMENT,QUERY,FRAGMENT>urin()Factory method for creatingUrins with just a scheme and empty path.Urin<SEGMENT,QUERY,FRAGMENT>urin(FRAGMENT fragment)Factory method for creatingUrins with just a scheme, fragment, and empty path.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority)Factory method for creatingUrins with just scheme, authority, and empty path components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, FRAGMENT fragment)Factory method for creatingUrins with just scheme, authority, fragment, and empty path components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, AbsolutePath<SEGMENT> path)Factory method for creatingUrins with just scheme, authority, and path components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, AbsolutePath<SEGMENT> path, FRAGMENT fragment)Factory method for creatingUrins with just scheme, authority, path, and fragment components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, AbsolutePath<SEGMENT> path, QUERY query)Factory method for creatingUrins with just scheme, authority, path, and query components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, AbsolutePath<SEGMENT> path, QUERY query, FRAGMENT fragment)Factory method for creatingUrins with scheme, authority, path, query, and fragment components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, QUERY query)Factory method for creatingUrins with just scheme, authority, query, and empty path components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Authority authority, QUERY query, FRAGMENT fragment)Factory method for creatingUrins with scheme, authority, empty path, query, and fragment components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Path<SEGMENT> path)Factory method for creatingUrins with just scheme and path components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Path<SEGMENT> path, FRAGMENT fragment)Factory method for creatingUrins with just scheme, path, and fragment components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Path<SEGMENT> path, QUERY query)Factory method for creatingUrins with just scheme, path, and query components.Urin<SEGMENT,QUERY,FRAGMENT>urin(Path<SEGMENT> path, QUERY query, FRAGMENT fragment)Factory method for creatingUrins with scheme, path, query, and fragment components.Urin<SEGMENT,QUERY,FRAGMENT>urin(QUERY query)Factory method for creatingUrins with just a scheme, query, and empty path.Urin<SEGMENT,QUERY,FRAGMENT>urin(QUERY query, FRAGMENT fragment)Factory method for creatingUrins with scheme, empty path, query, and fragment components.
-
-
-
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 creatingSchemes. 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- aStringcontaining at least one character, made up of any characters in the Latin alphabet, the digits, and the characters '+', '-', and '.'.- Returns:
- a
Schemerepresenting the givenString. - Throws:
java.lang.IllegalArgumentException- if the givenStringis 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 creatingSchemes 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.comis equivalent to, and preferred tohttp://example.com:80.- Parameters:
name- aStringcontaining at least one character, made up of any characters in the Latin alphabet, the digits, and the characters '+', '-', and '.'.defaultPort-Portrepresenting the default port for this name.- Returns:
- a
Schemerepresenting the givenString, using the given default port. - Throws:
java.lang.IllegalArgumentException- if the givenStringis 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 creatingRelativeReferences with just an empty path.- Returns:
- a
RelativeReferencewith an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority)
Factory method for creatingRelativeReferences with an authority and an empty path.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthorityand an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Path<SEGMENT> path)
Factory method for creatingRelativeReferences with just a path.- Parameters:
path- anyPathto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenPath.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, AbsolutePath<SEGMENT> path)
Factory method for creatingRelativeReferences with an authority and a path.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.path- anyAbsolutePathto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthorityandPath.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(QUERY query)
Factory method for creatingRelativeReferences with a query and an empty path.- Parameters:
query- anyQueryto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenQueryand an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, QUERY query)
Factory method for creatingRelativeReferences with an authority, a query and an empty path.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.query- anyQueryto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthorityandQuery, and an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Path<SEGMENT> path, QUERY query)
Factory method for creatingRelativeReferences with a path and a query.- Parameters:
path- anyPathto use in thisRelativeReference.query- anyQueryto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenPathandQuery.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, AbsolutePath<SEGMENT> path, QUERY query)
Factory method for creatingRelativeReferences with an authority, a path, and a query.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.path- anyPathto use in thisRelativeReference.query- anyQueryto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthority,PathandQuery.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(FRAGMENT fragment)
Factory method for creatingRelativeReferences with a fragment and an empty path.- Parameters:
fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenFragmentand an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, FRAGMENT fragment)
Factory method for creatingRelativeReferences with an authority, a fragment, and an empty path.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthorityandFragment, and an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Path<SEGMENT> path, FRAGMENT fragment)
Factory method for creatingRelativeReferences with a path and a fragment.- Parameters:
path- anyPathto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenPathandFragment.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, AbsolutePath<SEGMENT> path, FRAGMENT fragment)
Factory method for creatingRelativeReferences with an authority, a path, and fragment.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.path- anyAbsolutePathto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthority,PathandFragment.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(QUERY query, FRAGMENT fragment)
Factory method for creatingRelativeReferences with a query, a fragment, and an empty path.- Parameters:
query- anyQueryto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenQueryandFragment, and an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, QUERY query, FRAGMENT fragment)
Factory method for creatingRelativeReferences with an authority, a query, a fragment, and an empty path.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.query- anyQueryto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthority,QueryandFragment, and an empty path.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Path<SEGMENT> path, QUERY query, FRAGMENT fragment)
Factory method for creatingRelativeReferences with a path, a query, and a fragment.- Parameters:
path- anyPathto use in thisRelativeReference.query- anyQueryto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenPath,QueryandFragment.
-
relativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> relativeReference(Authority authority, AbsolutePath<SEGMENT> path, QUERY query, FRAGMENT fragment)
Factory method for creatingRelativeReferences with an authority, a path, a query, and a fragment.- Parameters:
authority- anyAuthorityto use in thisRelativeReference.path- anyAbsolutePathto use in thisRelativeReference.query- anyQueryto use in thisRelativeReference.fragment- anyFragmentto use in thisRelativeReference.- Returns:
- a
RelativeReferencewith the givenAuthority,Path,QueryandFragment.
-
parseRelativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> parseRelativeReference(java.lang.String relativeReferenceString) throws ParseException
Parses the givenStringas a relative reference.- Parameters:
relativeReferenceString- aStringthat represents a relative reference.- Returns:
- a
UrinReferencerepresenting the relative reference represented by the givenString. - Throws:
ParseException- if the givenStringis not a valid relative reference.
-
parseRelativeReference
public final RelativeReference<SEGMENT,QUERY,FRAGMENT> parseRelativeReference(java.net.URI uri) throws ParseException
Parses the givenURIto produce aRelativeReference.- Parameters:
uri- aURIrepresenting a relative reference to parse.- Returns:
- a
RelativeReferencerepresenting the RFC 3986 relative reference represented by the givenURI. - Throws:
ParseException- if the givenURIis not a valid RFC 3986 relative reference.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin()
Factory method for creatingUrins with just a scheme and empty path.- Returns:
- a
Urinwith the givenSchemeand an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Path<SEGMENT> path)
Factory method for creatingUrins with just scheme and path components.- Parameters:
path- anyPathto use in thisUrin.- Returns:
- a
Urinwith the givenSchemeandPath.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority)
Factory method for creatingUrins with just scheme, authority, and empty path components.- Parameters:
authority- anyAuthorityto use in thisUrin.- Returns:
- a
Urinwith the givenSchemeandAuthority, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, AbsolutePath<SEGMENT> path)
Factory method for creatingUrins with just scheme, authority, and path components.- Parameters:
authority- anyAuthorityto use in thisUrin.path- anyAbsolutePathto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority, andAbsolutePath.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(FRAGMENT fragment)
Factory method for creatingUrins with just a scheme, fragment, and empty path.- Parameters:
fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme, the givenFragment, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Path<SEGMENT> path, FRAGMENT fragment)
Factory method for creatingUrins with just scheme, path, and fragment components.- Parameters:
path- anyPathto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Fragment, andPath.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, FRAGMENT fragment)
Factory method for creatingUrins with just scheme, authority, fragment, and empty path components.- Parameters:
authority- anyAuthorityto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority, andFragment, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, AbsolutePath<SEGMENT> path, FRAGMENT fragment)
Factory method for creatingUrins with just scheme, authority, path, and fragment components.- Parameters:
authority- anyAuthorityto use in thisUrin.path- anyAbsolutePathto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority,AbsolutePath, andFragment.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(QUERY query)
Factory method for creatingUrins with just a scheme, query, and empty path.- Parameters:
query- anyQueryto use in thisUrin.- Returns:
- a
Urinwith the givenScheme, the givenQuery, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Path<SEGMENT> path, QUERY query)
Factory method for creatingUrins with just scheme, path, and query components.- Parameters:
path- anyPathto use in thisUrin.query- anyQueryto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Query, andPath.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, QUERY query)
Factory method for creatingUrins with just scheme, authority, query, and empty path components.- Parameters:
authority- anyAuthorityto use in thisUrin.query- anyQueryto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority, andQuery, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, AbsolutePath<SEGMENT> path, QUERY query)
Factory method for creatingUrins with just scheme, authority, path, and query components.- Parameters:
authority- anyAuthorityto use in thisUrin.path- anyAbsolutePathto use in thisUrin.query- anyQueryto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority,AbsolutePath, andQuery.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(QUERY query, FRAGMENT fragment)
Factory method for creatingUrins with scheme, empty path, query, and fragment components.- Parameters:
query- anyQueryto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Query, andFragment, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Path<SEGMENT> path, QUERY query, FRAGMENT fragment)
Factory method for creatingUrins with scheme, path, query, and fragment components.- Parameters:
path- anyPathto use in thisUrin.query- anyQueryto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Path,Query, andFragment.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, QUERY query, FRAGMENT fragment)
Factory method for creatingUrins with scheme, authority, empty path, query, and fragment components.- Parameters:
authority- anyAuthorityto use in thisUrin.query- anyQueryto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority,Query, andFragment, and an empty path.
-
urin
public final Urin<SEGMENT,QUERY,FRAGMENT> urin(Authority authority, AbsolutePath<SEGMENT> path, QUERY query, FRAGMENT fragment)
Factory method for creatingUrins with scheme, authority, path, query, and fragment components.- Parameters:
authority- anyAuthorityto use in thisUrin.path- anyAbsolutePathto use in thisUrin.query- anyQueryto use in thisUrin.fragment- anyFragmentto use in thisUrin.- Returns:
- a
Urinwith the givenScheme,Authority,AbsolutePath,Query, andFragment.
-
parseUrin
public final Urin<SEGMENT,QUERY,FRAGMENT> parseUrin(java.lang.String uriString) throws ParseException
Parses the givenStringas a URI.- Parameters:
uriString- aStringthat represents a URI.- Returns:
- a
Urinrepresenting the URI represented by the givenString. - Throws:
ParseException- if the givenStringis not a valid URI.
-
parseUrin
public final Urin<SEGMENT,QUERY,FRAGMENT> parseUrin(java.net.URI uri) throws ParseException
Parses the givenURIto produce aUrin.- Parameters:
uri- aURIto parse.- Returns:
- a
Urinrepresenting the RFC 3986 URI represented by the givenURI. - Throws:
ParseException- if the givenURIis not a valid RFC 3986 URI.
-
parseUrinReference
public final UrinReference<SEGMENT,QUERY,FRAGMENT> parseUrinReference(java.lang.String uriReferenceString) throws ParseException
Parses the givenStringas a URI reference.- Parameters:
uriReferenceString- aStringthat represents a URI reference.- Returns:
- a
UrinReferencerepresenting the URI reference represented by the givenString. - Throws:
ParseException- if the givenStringis not a valid URI reference.
-
parseUrinReference
public final UrinReference<SEGMENT,QUERY,FRAGMENT> parseUrinReference(java.net.URI uriReference) throws ParseException
Parses the givenURIto produce aUrinReference.- Parameters:
uriReference- aURIto parse.- Returns:
- a
UrinReferencerepresenting the RFC 3986 URI reference represented by the givenURI. - Throws:
ParseException- if the givenURIis not a valid RFC 3986 URI reference.
-
-