Class NormURL
-
- All Implemented Interfaces:
-
kotlin.Comparable
public class NormURL implements Comparable<NormURL>
NormURL stands for
normal url, which means the url is final and will be used to locate the resource.Every normal url contains two urls: a
urland ahref,urlstands for Uniform Resource Locator, both for external webpage and internal database record, andhrefstands for Hyperlink Reference, which contains a url extracted from an HTML document.Hrefis the first choice to locate resources, because it's extracted from the HTML document without modification, whileurlis typically normalized.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classNormURL.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Stringspecprivate final StringhrefSpecprivate final Stringargsprivate final StringconfiguredUrlprivate final Stringreferrerprivate final BooleanisNilprivate final BooleanisNotNilprivate final URLurlprivate final LoadOptionsoptionsprivate URLhrefprivate UrlAwaredetailpublic final static NormURL.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description NormURL(String spec, LoadOptions options, String hrefSpec, UrlAware detail)Construct a NormURL from a string url and a LoadOptions object. NormURL(URL url, LoadOptions options, URL href, UrlAware detail)
-
Method Summary
Modifier and Type Method Description final StringgetSpec()final StringgetHrefSpec()final StringgetArgs()final StringgetConfiguredUrl()final StringgetReferrer()final BooleanisNil()final BooleanisNotNil()final URLgetUrl()The url is final and will be used to locate the resource. final LoadOptionsgetOptions()The load options to be used to load the resource. final URLgetHref()The href is the raw url in the html without normalization, for example, an url with a timestamp query parameter added. final UnitsetHref(URL href)The href is the raw url in the html without normalization, for example, an url with a timestamp query parameter added. final UrlAwaregetDetail()A url aware object that contains the url and its related information. final UnitsetDetail(UrlAware detail)A url aware object that contains the url and its related information. final Stringcomponent1()The 1st-component, which is the url specification. final LoadOptionscomponent2()The 2nd-component, which is the load options. IntegerhashCode()The hash code of the object. Booleanequals(Object other)Whether the object is equal to this object. IntegercompareTo(NormURL other)Compare this object to another object. StringtoString()The string representation of the object. final static NormURLparse(String configuredUrl, VolatileConfig volatileConfig)Parse a configured url to a NormURL object. -
-
Constructor Detail
-
NormURL
NormURL(String spec, LoadOptions options, String hrefSpec, UrlAware detail)
Construct a NormURL from a string url and a LoadOptions object.
-
NormURL
NormURL(URL url, LoadOptions options, URL href, UrlAware detail)
-
-
Method Detail
-
getHrefSpec
final String getHrefSpec()
-
getConfiguredUrl
final String getConfiguredUrl()
-
getReferrer
final String getReferrer()
-
getOptions
final LoadOptions getOptions()
The load options to be used to load the resource.
-
getHref
final URL getHref()
The href is the raw url in the html without normalization, for example, an url with a timestamp query parameter added.
The href is the first choice to locate resources, because it's extracted from the HTML document without modification, while url is typically normalized.
-
setHref
final Unit setHref(URL href)
The href is the raw url in the html without normalization, for example, an url with a timestamp query parameter added.
The href is the first choice to locate resources, because it's extracted from the HTML document without modification, while url is typically normalized.
-
getDetail
final UrlAware getDetail()
A url aware object that contains the url and its related information.
-
setDetail
final Unit setDetail(UrlAware detail)
A url aware object that contains the url and its related information.
-
component1
final String component1()
The 1st-component, which is the url specification.
-
component2
final LoadOptions component2()
The 2nd-component, which is the load options.
-
equals
Boolean equals(Object other)
Whether the object is equal to this object.
- Parameters:
other- the object to be compared- Returns:
whether the object is equal to this object
-
compareTo
Integer compareTo(NormURL other)
Compare this object to another object.
- Parameters:
other- the object to be compared- Returns:
the comparison result
-
toString
String toString()
The string representation of the object.
- Returns:
the string representation of the object
-
-
-
-