Package org.refcodes.net
Class UrlSugar
- java.lang.Object
-
- org.refcodes.net.UrlSugar
-
public class UrlSugar extends java.lang.Object
Declarative syntactic sugar which may be statically imported in order to allow declarative definitions forUrl
(Url.UrlBuilder
) creation and tweaking:import static org.refcodes.net.UrlSugar.*;
-
-
Constructor Summary
Constructors Constructor Description UrlSugar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Url.UrlBuilder
toUrl()
Creates an emptyUrl.UrlBuilder
, make sure to set required attributes for a valid URL.Url.UrlBuilder
toUrl(java.lang.String aUrl)
Constructs anUrl.UrlBuilder
from the provided URLString
.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(java.net.URL aURL)
Constructs anUrl.UrlBuilder
from the providedURL
instance.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.Url.UrlBuilder
toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.
-
-
-
Method Detail
-
toUrl
public Url.UrlBuilder toUrl()
Creates an emptyUrl.UrlBuilder
, make sure to set required attributes for a valid URL.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aUrl) throws java.net.MalformedURLException
Constructs anUrl.UrlBuilder
from the provided URLString
.- Parameters:
aUrl
- The URLString
to be parsed.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance. - Throws:
java.net.MalformedURLException
- in case the provided URL is considered being malformed.
-
toUrl
public Url.UrlBuilder toUrl(java.net.URL aURL)
Constructs anUrl.UrlBuilder
from the providedURL
instance.- Parameters:
aURL
- TheURL
to be used.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, int aPort, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPort
- The port to be used when connecting to the host.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(org.refcodes.data.Scheme aScheme, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aScheme
- TheScheme
(e.g. HTTP or HTTPS) to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
toUrl
public Url.UrlBuilder toUrl(java.lang.String aProtocol, java.lang.String aHost, java.lang.String aPath, FormFields aQueryFields, java.lang.String aFragment)
Constructs anUrl.UrlBuilder
with the common attributes.- Parameters:
aProtocol
- The protocolString
(e.g. "http://" or "https://") to be used for the destination URL.aHost
- The host to which the destination URL is to point to.aPath
- The path on the host to which the base destination URL is to point to.aQueryFields
- The Query-Fields to be used for the HTTP Query-String.aFragment
- The fragment to be set.- Returns:
- The accordingly constructed
Url.UrlBuilder
instance.
-
-