- 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 TypeMethodDescriptionint
compareTo
(SinglePartialURL other) boolean
Gets 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 eithernull
or 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.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
-
compareTo
Ordering is consistent with:
- Specified by:
compareTo
in interfaceComparable<SinglePartialURL>
- See Also:
-
matches
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()
, 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:
matches
in classPartialURL
- Parameters:
fieldSource
- When all fields arenull
(this isPartialURL.DEFAULT
), this is not used and may benull
.- Returns:
this
when matches, ornull
when does not match.- 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()
.Implementation Note:
a partial URL is its own primary- Specified by:
getPrimary
in classPartialURL
- Returns:
this
because 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
equal
to theprimary
, returns the same object instance asPartialURL.getPrimary()
.Implementation Note:
iterates overthis
only- Specified by:
getCombinations
in classPartialURL
- See Also:
-
toURL
Description copied from class:PartialURL
Gets the general-purpose representation ofURL
for this partial URL.- 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:
-
getScheme
Gets the lower-case scheme (such as https/http/other) for this partial URL.- Returns:
- The scheme or
null
whenFieldSource.getScheme()
should be used. - See Also:
-
getHost
Gets the IP address or hostname for this partial URL.- Returns:
- The IP address/hostname or
null
whenFieldSource.getHost()
should be used. - See Also:
-
getPort
Gets the port number for this partial URL.- Returns:
- The port or
null
whenFieldSource.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
null
when thecontext path of the field source
should be used. - See Also:
-
getPrefix
Gets the prefix of the path for this partial URL, always eithernull
or ending in a slash (/). This is matched as a prefix ofFieldSource.getPath()
.- See Also:
-