- All Implemented Interfaces:
Comparable<SinglePartialURL>
PartialURL that may contain at most one 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 TypeMethodDescriptionintcompareTo(SinglePartialURL other) booleanGets all combinations of single partial URLs represented by this partial URL.Gets the context path for this partial URL, only ending in a slash (/) when isthe root context.getHost()Gets the IP address or hostname for this partial URL.getPort()Gets the port number for this partial URL.Gets the prefix 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 lower-case scheme (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
-
compareTo
Ordering is consistent with:
- Specified by:
compareToin interfaceComparable<SinglePartialURL>- See Also:
-
matches
Checks 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(), usingmatches(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:
thiswhen matches, ornullwhen does not match.- 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().Implementation Note:
a partial URL is its own primary- Specified by:
getPrimaryin classPartialURL- Returns:
thisbecause it is already a single partial URL- 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)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().Implementation Note:
iterates overthisonly- Specified by:
getCombinationsin classPartialURL- See Also:
-
toURL
Description copied from class:PartialURLGets the general-purpose representation ofURLfor this partial URL.- 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:
-
getScheme
Gets the lower-case scheme (such as https/http/other) for this partial URL.- Returns:
- The scheme or
nullwhenFieldSource.getScheme()should be used. - See Also:
-
getHost
Gets the IP address or hostname for this partial URL.- Returns:
- The IP address/hostname or
nullwhenFieldSource.getHost()should be used. - See Also:
-
getPort
Gets the port number for this partial URL.- Returns:
- The port or
nullwhenFieldSource.getPort()should be used. - See Also:
-
getContextPath
Gets the context path for this partial URL, only ending in a slash (/) when isthe root context.- Returns:
- The context path or
nullwhen thecontext path of the field sourceshould be used. - See Also:
-
getPrefix
Gets the prefix of the path for this partial URL, always eithernullor ending in a slash (/). This is matched as a prefix ofFieldSource.getPath().- See Also:
-
