PartialURL
that may contains multiple values for each field matched.
All fields are optional.-
Field Summary
Fields inherited from class com.aoapps.net.partialurl.PartialURL
DEFAULT, HTTP, HTTPS, NULL_CONTEXT_PATH, NULL_PREFIX, WILDCARD_CHAR, WILDCARD_STRING
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets all combinations of single partial URLs represented by this partial URL.Gets the unmodifiable set of context paths for this partial URL, only ending in a slash (/) when isthe root context
.getHosts()
Gets the unmodifiable set of IP addresses or hostnames for this partial URL.getPorts()
Gets the unmodifiable set of port numbers for this partial URL.Gets the unmodifiable set of prefixes of the path for this partial URL, always eithernull
or ending in a slash (/).Gets the primary single partial URL for this partial URL.Gets the unmodifiable set of lower-case schemes (such as https/http/other) for this partial URL.int
hashCode()
boolean
Checks if this partial URL is complete (has nonull
fields other than prefix).matches
(FieldSource fieldSource) Checks if the givenFieldSource
matches this partial URL.toString()
toURL
(FieldSource fieldSource) Gets the general-purpose representation ofURL
for this partial URL.
-
Method Details
-
toString
- Specified by:
toString
in classPartialURL
-
equals
- Specified by:
equals
in classPartialURL
-
hashCode
public int hashCode()- Specified by:
hashCode
in classPartialURL
-
matches
Description copied from class:PartialURL
Checks if the givenFieldSource
matches this partial URL.The
SinglePartialURL
returned, if any, is also in the set of partial URLs provided byPartialURL.getCombinations()
. Specifically, the match must be equivalent to the first match found by iterative calls to the results ofPartialURL.getCombinations()
, usingSinglePartialURL.matches(com.aoapps.net.partialurl.FieldSource)
on each single partial. The implementation, however, does not need to be iterative.Ordering is consistent with:
- Specified by:
matches
in classPartialURL
- Parameters:
fieldSource
- When all fields arenull
(this isPartialURL.DEFAULT
), this is not used and may benull
.- Returns:
- The
SinglePartialURL
with non-null fields selected to match the field source, ornull
when does not match. When the match isequals
theprimary
, returns the same object asPartialURL.getPrimary()
. - Throws:
MalformedURLException
-
isComplete
public boolean isComplete()Description copied from class:PartialURL
Checks if this partial URL is complete (has nonull
fields other than prefix). A complete URL may be converted to aURL
without anyfield source
provided.- Specified by:
isComplete
in classPartialURL
- See Also:
-
getPrimary
Gets the primary single partial URL for this partial URL.This will always be found in
PartialURL.getCombinations()
.When there is not more than one
prefix
, this will be the first value returned fromgetCombinations()
.Implementation Note:
Uses the first value from each set.- Specified by:
getPrimary
in classPartialURL
- See Also:
-
getCombinations
Gets all combinations of single partial URLs represented by this partial URL.Ordering is consistent with:
PartialURL.matches(com.aoapps.net.partialurl.FieldSource)
SinglePartialURL.compareTo(com.aoapps.net.partialurl.SinglePartialURL)
PartialURLMap.get(com.aoapps.net.partialurl.FieldSource)
When one of the results is
equal
to theprimary
, returns the same object instance asPartialURL.getPrimary()
.Sets are iterated in the following order:
getHosts()
getContextPaths()
getPrefixes()
(sorted by deepest first for consistency withSinglePartialURL.compareTo(com.aoapps.net.partialurl.SinglePartialURL)
)getPorts()
getSchemes()
When there is not more than one
prefix
, the first value returned will be theprimary
.TODO: A more space-efficient implementation could generate these on-the-fly. Or should we just return the generated
Set
? Will depend on how his is used.Implementation Note:
This currently generates the full set at the time of method invocation. This is not a performance-oriented implementation. Please seePartialURLMap
for a fast way to index partial URLs.- Specified by:
getCombinations
in classPartialURL
- See Also:
-
toURL
Gets the general-purpose representation ofURL
for this partial URL.Implementation Note:
This selects the specifically matching fields from each set when field source is non-null.- Specified by:
toURL
in classPartialURL
- Parameters:
fieldSource
- Only used when at least one field isnull
and uses the value from the source. May benull
when thisPartialURL
is known to have all fields specified.- Throws:
MalformedURLException
- See Also:
-
getSchemes
Gets the unmodifiable set of lower-case schemes (such as https/http/other) for this partial URL.- Returns:
- The schemes or
null
whenFieldSource.getScheme()
should be used. - See Also:
-
getHosts
Gets the unmodifiable set of IP addresses or hostnames for this partial URL.- Returns:
- The IP addresses/hostnames or
null
whenFieldSource.getHost()
should be used. - See Also:
-
getPorts
Gets the unmodifiable set of port numbers for this partial URL.- Returns:
- The ports or
null
whenFieldSource.getPort()
should be used. - See Also:
-
getContextPaths
Gets the unmodifiable set of context paths for this partial URL, only ending in a slash (/) when isthe root context
.- Returns:
- The context paths or
null
when thecontext path of the field source
should be used. - See Also:
-
getPrefixes
Gets the unmodifiable set of prefixes of the path for this partial URL, always eithernull
or ending in a slash (/). This is matched as a prefix ofFieldSource.getPath()
.- See Also:
-