- java.lang.Object
-
- org.refcodes.web.Url
-
- org.refcodes.web.UrlBuilder
-
- All Implemented Interfaces:
org.refcodes.mixin.CredentialsAccessor
,org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<UrlBuilder>
,org.refcodes.mixin.CredentialsAccessor.CredentialsMutator
,org.refcodes.mixin.CredentialsAccessor.CredentialsProperty
,org.refcodes.mixin.Dumpable
,org.refcodes.mixin.IdentityAccessor
,org.refcodes.mixin.IdentityAccessor.IdentityBuilder<UrlBuilder>
,org.refcodes.mixin.IdentityAccessor.IdentityMutator
,org.refcodes.mixin.IdentityAccessor.IdentityProperty
,org.refcodes.mixin.PathAccessor
,org.refcodes.mixin.PathAccessor.PathBuilder<UrlBuilder>
,org.refcodes.mixin.PathAccessor.PathMutator
,org.refcodes.mixin.PathAccessor.PathProperty
,org.refcodes.mixin.PortAccessor
,org.refcodes.mixin.PortAccessor.PortBuilder<UrlBuilder>
,org.refcodes.mixin.PortAccessor.PortMutator
,org.refcodes.mixin.PortAccessor.PortProperty
,org.refcodes.mixin.SecretAccessor
,org.refcodes.mixin.SecretAccessor.SecretBuilder<UrlBuilder>
,org.refcodes.mixin.SecretAccessor.SecretMutator
,org.refcodes.mixin.SecretAccessor.SecretProperty
,org.refcodes.net.IpAddressAccessor
,org.refcodes.net.IpAddressAccessor.IpAddressBuilder<UrlBuilder>
,org.refcodes.net.IpAddressAccessor.IpAddressMutator
,org.refcodes.net.IpAddressAccessor.IpAddressProperty
,FragmentAccessor
,FragmentAccessor.FragmentBuilder<UrlBuilder>
,FragmentAccessor.FragmentMutator
,FragmentAccessor.FragmentProperty
,HostAccessor
,HostAccessor.HostBuilder<UrlBuilder>
,HostAccessor.HostMutator
,HostAccessor.HostProperty
,QueryFieldsAccessor
,QueryFieldsAccessor.QueryFieldsBuilder<UrlBuilder>
,QueryFieldsAccessor.QueryFieldsMutator
,QueryFieldsAccessor.QueryFieldsProperty
,SchemeAccessor
,SchemeAccessor.SchemeBuilder<UrlBuilder>
,SchemeAccessor.SchemeMutator
,SchemeAccessor.SchemeProperty
public class UrlBuilder extends Url implements SchemeAccessor.SchemeProperty, SchemeAccessor.SchemeBuilder<UrlBuilder>, HostAccessor.HostProperty, HostAccessor.HostBuilder<UrlBuilder>, org.refcodes.net.IpAddressAccessor.IpAddressProperty, org.refcodes.net.IpAddressAccessor.IpAddressBuilder<UrlBuilder>, org.refcodes.mixin.PortAccessor.PortProperty, org.refcodes.mixin.PortAccessor.PortBuilder<UrlBuilder>, org.refcodes.mixin.PathAccessor.PathProperty, org.refcodes.mixin.PathAccessor.PathBuilder<UrlBuilder>, QueryFieldsAccessor.QueryFieldsProperty, QueryFieldsAccessor.QueryFieldsBuilder<UrlBuilder>, FragmentAccessor.FragmentProperty, FragmentAccessor.FragmentBuilder<UrlBuilder>, org.refcodes.mixin.CredentialsAccessor.CredentialsProperty, org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<UrlBuilder>
TheUrlBuilder
extends an immutableUrl
with mutable functionality.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.CredentialsAccessor
org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<B extends org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<B>>, org.refcodes.mixin.CredentialsAccessor.CredentialsMutator, org.refcodes.mixin.CredentialsAccessor.CredentialsProperty
-
Nested classes/interfaces inherited from interface org.refcodes.web.FragmentAccessor
FragmentAccessor.FragmentBuilder<B extends FragmentAccessor.FragmentBuilder<?>>, FragmentAccessor.FragmentMutator, FragmentAccessor.FragmentProperty
-
Nested classes/interfaces inherited from interface org.refcodes.web.HostAccessor
HostAccessor.HostBuilder<B extends HostAccessor.HostBuilder<?>>, HostAccessor.HostMutator, HostAccessor.HostProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.IdentityAccessor
org.refcodes.mixin.IdentityAccessor.IdentityBuilder<B extends org.refcodes.mixin.IdentityAccessor.IdentityBuilder<B>>, org.refcodes.mixin.IdentityAccessor.IdentityMutator, org.refcodes.mixin.IdentityAccessor.IdentityProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.IpAddressAccessor
org.refcodes.net.IpAddressAccessor.IpAddressBuilder<B extends org.refcodes.net.IpAddressAccessor.IpAddressBuilder<B>>, org.refcodes.net.IpAddressAccessor.IpAddressMutator, org.refcodes.net.IpAddressAccessor.IpAddressProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.PathAccessor
org.refcodes.mixin.PathAccessor.PathBuilder<B extends org.refcodes.mixin.PathAccessor.PathBuilder<?>>, org.refcodes.mixin.PathAccessor.PathMutator, org.refcodes.mixin.PathAccessor.PathProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.PortAccessor
org.refcodes.mixin.PortAccessor.PortBuilder<B extends org.refcodes.mixin.PortAccessor.PortBuilder<B>>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty
-
Nested classes/interfaces inherited from interface org.refcodes.web.QueryFieldsAccessor
QueryFieldsAccessor.QueryFieldsBuilder<B extends QueryFieldsAccessor.QueryFieldsBuilder<?>>, QueryFieldsAccessor.QueryFieldsMutator, QueryFieldsAccessor.QueryFieldsProperty
-
Nested classes/interfaces inherited from interface org.refcodes.web.SchemeAccessor
SchemeAccessor.SchemeBuilder<B extends SchemeAccessor.SchemeBuilder<B>>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty
-
-
Constructor Summary
Constructors Constructor Description UrlBuilder()
UrlBuilder(String aUrl)
UrlBuilder(String aProtocol, String aHost)
UrlBuilder(String aProtocol, String aHost, int aPort)
UrlBuilder(String aProtocol, String aHost, int aPort, String aPath)
UrlBuilder(String aProtocol, String aHost, int aPort, String aPath, FormFields aQueryFields)
UrlBuilder(String aProtocol, String aHost, int aPort, String aPath, FormFields aQueryFields, String aFragment)
UrlBuilder(String aProtocol, String aHost, String aPath)
UrlBuilder(String aProtocol, String aHost, String aPath, FormFields aQueryFields)
UrlBuilder(String aProtocol, String aHost, String aPath, FormFields aQueryFields, String aFragment)
UrlBuilder(String aUrl, FormFields aQueryFields)
UrlBuilder(String aUrl, FormFields aQueryFields, String aFragment)
UrlBuilder(URL aURL)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort, String aPath)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort, String aPath, FormFields aQueryFields)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort, String aPath, FormFields aQueryFields, String aFragment)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, String aPath)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, String aPath, FormFields aQueryFields)
UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, String aPath, FormFields aQueryFields, String aFragment)
UrlBuilder(Url aUrl)
UrlBuilder(Url aUrl, String... aPaths)
UrlBuilder(Url aUrl, Url aOtherUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToQueryFields(String aField, String aValue)
Adds a value to the list of values associated with the given Query-Field (key).void
addToQueryFields(String aField, String... aValues)
Adds values to the list of values associated with the given Query-Field (key).void
appendToPath(String aPathElement)
Appends a path element to the path.void
appendToPath(String... aPathElements)
Appends multiple path elements to the path, automatically adding the path separator "/" as required.void
fromUrl(String aUrl)
void
fromURL(URL aUrl)
void
setFragment(String aFragment)
Sets the fragment for the fragment property.void
setHost(String aHost)
Sets the host for the host property.void
setIdentity(String aIdentity)
void
setIpAddress(int[] aIpAddress)
void
setPath(String aPath)
void
setPort(int aPort)
void
setProtocol(String aProtocol)
Sets the protocolString
representation for the scheme property.void
setQueryFields(FormFields aQueryFields)
Sets the request Query-Fields for the request Query-Fields property.void
setScheme(org.refcodes.data.Scheme aScheme)
Sets the UrlScheme for the URL scheme.void
setSecret(String aSecret)
String
toString()
UrlBuilder
withAddToQueryFields(String aField, String aValue)
Adds a value to the list of values associated with the given Query-Field (key) and returns this builder as of the Builder-Pattern.UrlBuilder
withAddToQueryFields(String aField, String... aValues)
Adds values to the list of values associated with the given Query-Field (key) and returns this builder as of the Builder-Pattern.UrlBuilder
withAppendToPath(String aPath)
Appends a path element to the path as of the Builder-Pattern.UrlBuilder
withAppendToPath(String... aPathElements)
Appends multiple path elements to the path, automatically adding the path separator "/" as required as of the Builder-Pattern.UrlBuilder
withCidrNotation(String aCidrNotation)
UrlBuilder
withFragment(String aFragment)
Sets the fragment to use and returns this builder as of the builder pattern.UrlBuilder
withHost(String aHost)
Sets the host to use and returns this builder as of the builder pattern.UrlBuilder
withIdentity(String aIdentity)
UrlBuilder
withIpAddress(int[] aIpAddress)
UrlBuilder
withPath(String aPath)
UrlBuilder
withPort(int aPort)
UrlBuilder
withProtocol(String aProtocol)
Sets the protocol for the URL scheme.UrlBuilder
withQueryFields(FormFields aQueryFields)
Sets the request Query-Fields to use and returns this builder as of the Builder-Pattern.UrlBuilder
withScheme(org.refcodes.data.Scheme aScheme)
Sets the UrlScheme for the URL scheme.UrlBuilder
withSecret(String aSecret)
-
Methods inherited from class org.refcodes.web.Url
getFragment, getHost, getIdentity, getIpAddress, getPath, getPort, getQueryFields, getScheme, getSecret, toHost, toHttpUrl, toLocator, toProtocol, toTruncatePath, toTruncatePathPrefix, toTruncatePathSuffix, toURL
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.web.FragmentAccessor
getFragment
-
Methods inherited from interface org.refcodes.web.FragmentAccessor.FragmentProperty
letFragment
-
Methods inherited from interface org.refcodes.web.HostAccessor
getHost
-
Methods inherited from interface org.refcodes.web.HostAccessor.HostProperty
letHost
-
Methods inherited from interface org.refcodes.net.IpAddressAccessor.IpAddressMutator
fromCidrNotation
-
Methods inherited from interface org.refcodes.web.QueryFieldsAccessor
getQueryFields
-
Methods inherited from interface org.refcodes.web.QueryFieldsAccessor.QueryFieldsProperty
letQueryFields
-
Methods inherited from interface org.refcodes.web.SchemeAccessor
getScheme, toProtocol
-
Methods inherited from interface org.refcodes.web.SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
-
-
-
Constructor Detail
-
UrlBuilder
public UrlBuilder()
-
UrlBuilder
public UrlBuilder(Url aUrl)
-
UrlBuilder
public UrlBuilder(String aUrl) throws MalformedURLException
- Throws:
MalformedURLException
-
UrlBuilder
public UrlBuilder(String aUrl, FormFields aQueryFields) throws MalformedURLException
- Throws:
MalformedURLException
-
UrlBuilder
public UrlBuilder(String aUrl, FormFields aQueryFields, String aFragment) throws MalformedURLException
- Throws:
MalformedURLException
-
UrlBuilder
public UrlBuilder(URL aURL)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort, String aPath, FormFields aQueryFields, String aFragment)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort, String aPath, FormFields aQueryFields)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, int aPort, String aPath)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, String aPath, FormFields aQueryFields, String aFragment)
-
UrlBuilder
public UrlBuilder(org.refcodes.data.Scheme aScheme, String aHost, String aPath, FormFields aQueryFields)
-
UrlBuilder
public UrlBuilder(String aProtocol, String aHost, int aPort, String aPath, FormFields aQueryFields, String aFragment)
-
UrlBuilder
public UrlBuilder(String aProtocol, String aHost, int aPort, String aPath, FormFields aQueryFields)
-
UrlBuilder
public UrlBuilder(String aProtocol, String aHost, String aPath, FormFields aQueryFields, String aFragment)
-
UrlBuilder
public UrlBuilder(String aProtocol, String aHost, String aPath, FormFields aQueryFields)
-
-
Method Detail
-
fromUrl
public void fromUrl(String aUrl) throws MalformedURLException
- Overrides:
fromUrl
in classUrl
- Parameters:
aUrl
- The URL from which to determine the state.- Throws:
MalformedURLException
- in case the provided URL is considered being malformed.
-
fromURL
public void fromURL(URL aUrl)
-
withScheme
public UrlBuilder withScheme(org.refcodes.data.Scheme aScheme)
Sets the UrlScheme for the URL scheme.- Specified by:
withScheme
in interfaceSchemeAccessor.SchemeBuilder<UrlBuilder>
- Parameters:
aScheme
- The UrlScheme to be stored by the URL scheme.- Returns:
- The builder for applying multiple build operations.
-
withProtocol
public UrlBuilder withProtocol(String aProtocol)
Sets the protocol for the URL scheme.- Specified by:
withProtocol
in interfaceSchemeAccessor.SchemeBuilder<UrlBuilder>
- Parameters:
aProtocol
- The protocol to be stored by the URL scheme.- Returns:
- The builder for applying multiple build operations.
-
withHost
public UrlBuilder withHost(String aHost)
Sets the host to use and returns this builder as of the builder pattern.- Specified by:
withHost
in interfaceHostAccessor.HostBuilder<UrlBuilder>
- Parameters:
aHost
- The host to be stored by the host property.- Returns:
- This
HostAccessor.HostBuilder
instance to continue configuration.
-
withIpAddress
public UrlBuilder withIpAddress(int[] aIpAddress)
- Specified by:
withIpAddress
in interfaceorg.refcodes.net.IpAddressAccessor.IpAddressBuilder<UrlBuilder>
-
withCidrNotation
public UrlBuilder withCidrNotation(String aCidrNotation)
- Specified by:
withCidrNotation
in interfaceorg.refcodes.net.IpAddressAccessor.IpAddressBuilder<UrlBuilder>
-
withPort
public UrlBuilder withPort(int aPort)
- Specified by:
withPort
in interfaceorg.refcodes.mixin.PortAccessor.PortBuilder<UrlBuilder>
-
withPath
public UrlBuilder withPath(String aPath)
- Specified by:
withPath
in interfaceorg.refcodes.mixin.PathAccessor.PathBuilder<UrlBuilder>
-
appendToPath
public void appendToPath(String aPathElement)
Appends a path element to the path.- Parameters:
aPathElement
- The path element to be appended.
-
appendToPath
public void appendToPath(String... aPathElements)
Appends multiple path elements to the path, automatically adding the path separator "/" as required.- Parameters:
aPathElements
- The path elements to be appended.
-
withAppendToPath
public UrlBuilder withAppendToPath(String aPath)
Appends a path element to the path as of the Builder-Pattern.- Parameters:
aPath
- The path element to be appended.- Returns:
- This
UrlBuilder
instance to continue configuration.
-
withAppendToPath
public UrlBuilder withAppendToPath(String... aPathElements)
Appends multiple path elements to the path, automatically adding the path separator "/" as required as of the Builder-Pattern.- Parameters:
aPathElements
- The path elements to be appended.- Returns:
- This
UrlBuilder
instance to continue configuration.
-
withQueryFields
public UrlBuilder withQueryFields(FormFields aQueryFields)
Sets the request Query-Fields to use and returns this builder as of the Builder-Pattern.- Specified by:
withQueryFields
in interfaceQueryFieldsAccessor.QueryFieldsBuilder<UrlBuilder>
- Parameters:
aQueryFields
- The request Query-Fields to be stored by the form fields property.- Returns:
- This
FormFieldsAccessor.FormFieldsBuilder
instance to continue configuration.
-
addToQueryFields
public void addToQueryFields(String aField, String aValue)
Adds a value to the list of values associated with the given Query-Field (key).- Parameters:
aField
- The Query-Field (key) of which's list of values a value is to be added.aValue
- The value to be added to the list of values associated to the given Query-Field (key).
-
addToQueryFields
public void addToQueryFields(String aField, String... aValues)
Adds values to the list of values associated with the given Query-Field (key).- Parameters:
aField
- The Query-Field (key) of which's list of values the values are to be added.aValues
- The values to be added to the list of values associated to the given Query-Field (key).
-
withAddToQueryFields
public UrlBuilder withAddToQueryFields(String aField, String aValue)
Adds a value to the list of values associated with the given Query-Field (key) and returns this builder as of the Builder-Pattern.- Parameters:
aField
- The Query-Field (key) of which's list of values a value is to be added.aValue
- The value to be added to the list of values associated to the given Query-Field (key).- Returns:
- This
UrlBuilder
instance to continue configuration.
-
withAddToQueryFields
public UrlBuilder withAddToQueryFields(String aField, String... aValues)
Adds values to the list of values associated with the given Query-Field (key) and returns this builder as of the Builder-Pattern.- Parameters:
aField
- The Query-Field (key) of which's list of values the values are to be added.aValues
- The values to be added to the list of values associated to the given Query-Field (key).- Returns:
- This
UrlBuilder
instance to continue configuration.
-
withFragment
public UrlBuilder withFragment(String aFragment)
Sets the fragment to use and returns this builder as of the builder pattern.- Specified by:
withFragment
in interfaceFragmentAccessor.FragmentBuilder<UrlBuilder>
- Parameters:
aFragment
- The fragment to be stored by the fragment property.- Returns:
- This
FragmentAccessor.FragmentBuilder
instance to continue configuration.
-
withIdentity
public UrlBuilder withIdentity(String aIdentity)
- Specified by:
withIdentity
in interfaceorg.refcodes.mixin.IdentityAccessor.IdentityBuilder<UrlBuilder>
-
withSecret
public UrlBuilder withSecret(String aSecret)
- Specified by:
withSecret
in interfaceorg.refcodes.mixin.SecretAccessor.SecretBuilder<UrlBuilder>
-
setScheme
public void setScheme(org.refcodes.data.Scheme aScheme)
Sets the UrlScheme for the URL scheme.- Specified by:
setScheme
in interfaceSchemeAccessor.SchemeMutator
- Overrides:
setScheme
in classUrl
- Parameters:
aScheme
- The UrlScheme to be stored by the URL scheme.
-
setProtocol
public void setProtocol(String aProtocol)
Sets the protocolString
representation for the scheme property. You must provide the scheme's specific part as well. In case of HTTP, provide "http://". In case your provided protocol is unknown by theScheme
enumeration, then the scheme property will not be set, though theSchemeAccessor.toProtocol()
still returns your protocol.- Specified by:
setProtocol
in interfaceSchemeAccessor.SchemeMutator
- Overrides:
setProtocol
in classUrl
- Parameters:
aProtocol
- The UrlScheme'sString
representation to be stored by the URL scheme.
-
setHost
public void setHost(String aHost)
Sets the host for the host property.- Specified by:
setHost
in interfaceHostAccessor.HostMutator
- Overrides:
setHost
in classUrl
- Parameters:
aHost
- The host to be stored by the host property.
-
setIpAddress
public void setIpAddress(int[] aIpAddress)
- Specified by:
setIpAddress
in interfaceorg.refcodes.net.IpAddressAccessor.IpAddressMutator
- Overrides:
setIpAddress
in classUrl
-
setPort
public void setPort(int aPort)
-
setPath
public void setPath(String aPath)
-
setQueryFields
public void setQueryFields(FormFields aQueryFields)
Sets the request Query-Fields for the request Query-Fields property.- Specified by:
setQueryFields
in interfaceQueryFieldsAccessor.QueryFieldsMutator
- Parameters:
aQueryFields
- The request Query-Fields to be stored by the form fields property.
-
setFragment
public void setFragment(String aFragment)
Sets the fragment for the fragment property.- Specified by:
setFragment
in interfaceFragmentAccessor.FragmentMutator
- Parameters:
aFragment
- The fragment to be stored by the fragment property.
-
setIdentity
public void setIdentity(String aIdentity)
- Specified by:
setIdentity
in interfaceorg.refcodes.mixin.IdentityAccessor.IdentityMutator
-
setSecret
public void setSecret(String aSecret)
- Specified by:
setSecret
in interfaceorg.refcodes.mixin.SecretAccessor.SecretMutator
-
-