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 TypeMethodDescriptionbooleanGets 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 eithernullor 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.inthashCode()booleanChecks if this partial URL is complete (has nonullfields other than prefix).matches(FieldSource fieldSource) Checks if the givenFieldSourcematches this partial URL.toString()toURL(FieldSource fieldSource) Gets the general-purpose representation ofURLfor this partial URL.
-
Method Details
-
toString
- Specified by:
toStringin classPartialURL
-
equals
- Specified by:
equalsin classPartialURL
-
hashCode
public int hashCode()- Specified by:
hashCodein classPartialURL
-
matches
Description copied from class:PartialURLChecks if the givenFieldSourcematches this partial URL.The
SinglePartialURLreturned, 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:
matchesin classPartialURL- Parameters:
fieldSource- When all fields arenull(this isPartialURL.DEFAULT), this is not used and may benull.- Returns:
- The
SinglePartialURLwith non-null fields selected to match the field source, ornullwhen does not match. When the match isequalstheprimary, returns the same object asPartialURL.getPrimary(). - Throws:
MalformedURLException
-
isComplete
public boolean isComplete()Description copied from class:PartialURLChecks if this partial URL is complete (has nonullfields other than prefix). A complete URL may be converted to aURLwithout anyfield sourceprovided.- Specified by:
isCompletein 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:
getPrimaryin 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
equalto 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 seePartialURLMapfor a fast way to index partial URLs.- Specified by:
getCombinationsin classPartialURL- See Also:
-
toURL
Gets the general-purpose representation ofURLfor this partial URL.Implementation Note:
This selects the specifically matching fields from each set when field source is non-null.- Specified by:
toURLin classPartialURL- Parameters:
fieldSource- Only used when at least one field isnulland uses the value from the source. May benullwhen thisPartialURLis 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
nullwhenFieldSource.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
nullwhenFieldSource.getHost()should be used. - See Also:
-
getPorts
Gets the unmodifiable set of port numbers for this partial URL.- Returns:
- The ports or
nullwhenFieldSource.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
nullwhen thecontext path of the field sourceshould be used. - See Also:
-
getPrefixes
Gets the unmodifiable set of prefixes of the path for this partial URL, always eithernullor ending in a slash (/). This is matched as a prefix ofFieldSource.getPath().- See Also:
-
