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>
The
UrlBuilder
extends an immutable Url
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
Nested classes/interfaces inherited from interface org.refcodes.mixin.SecretAccessor
org.refcodes.mixin.SecretAccessor.SecretBuilder<B extends org.refcodes.mixin.SecretAccessor.SecretBuilder<B>>, org.refcodes.mixin.SecretAccessor.SecretMutator, org.refcodes.mixin.SecretAccessor.SecretProperty
-
Field Summary
-
Constructor Summary
ConstructorDescriptionUrlBuilder
(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
Modifier and TypeMethodDescriptionvoid
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
void
void
setFragment
(String aFragment) Sets the fragment for the fragment property.void
Sets the host for the host property.void
setIdentity
(String aIdentity) void
setIpAddress
(int[] aIpAddress) void
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
toString()
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.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.withAppendToPath
(String aPath) Appends a path element to the path as of the Builder-Pattern.withAppendToPath
(String... aPathElements) Appends multiple path elements to the path, automatically adding the path separator "/" as required as of the Builder-Pattern.withCidrNotation
(String aCidrNotation) withFragment
(String aFragment) Sets the fragment to use and returns this builder as of the builder pattern.Sets the host to use and returns this builder as of the builder pattern.withIdentity
(String aIdentity) withIpAddress
(int[] aIpAddress) withPort
(int aPort) withProtocol
(String aProtocol) Sets the protocol for the URL scheme.withQueryFields
(FormFields aQueryFields) Sets the request Query-Fields to use and returns this builder as of the Builder-Pattern.withScheme
(org.refcodes.data.Scheme aScheme) Sets the UrlScheme for the URL scheme.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.mixin.Dumpable
toDump, toDump
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.mixin.IdentityAccessor
getIdentity
Methods inherited from interface org.refcodes.mixin.IdentityAccessor.IdentityProperty
letIdentity
Methods inherited from interface org.refcodes.net.IpAddressAccessor
getIpAddress, toCidrNotation
Methods inherited from interface org.refcodes.net.IpAddressAccessor.IpAddressMutator
fromCidrNotation
Methods inherited from interface org.refcodes.net.IpAddressAccessor.IpAddressProperty
letIpAddress
Methods inherited from interface org.refcodes.mixin.PathAccessor
getPath
Methods inherited from interface org.refcodes.mixin.PathAccessor.PathProperty
letPath
Methods inherited from interface org.refcodes.mixin.PortAccessor
getPort
Methods inherited from interface org.refcodes.mixin.PortAccessor.PortProperty
letPort
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
Methods inherited from interface org.refcodes.mixin.SecretAccessor
getSecret
Methods inherited from interface org.refcodes.mixin.SecretAccessor.SecretProperty
letSecret
-
Constructor Details
-
UrlBuilder
public UrlBuilder() -
UrlBuilder
-
UrlBuilder
- Throws:
MalformedURLException
-
UrlBuilder
- Throws:
MalformedURLException
-
UrlBuilder
public UrlBuilder(String aUrl, FormFields aQueryFields, String aFragment) throws MalformedURLException - Throws:
MalformedURLException
-
UrlBuilder
-
UrlBuilder
-
UrlBuilder
-
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
-
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
-
UrlBuilder
public UrlBuilder(String aProtocol, String aHost, int aPort, String aPath, FormFields aQueryFields, String aFragment) -
UrlBuilder
-
UrlBuilder
-
UrlBuilder
-
UrlBuilder
public UrlBuilder(String aProtocol, String aHost, String aPath, FormFields aQueryFields, String aFragment) -
UrlBuilder
-
UrlBuilder
-
UrlBuilder
-
UrlBuilder
-
UrlBuilder
-
-
Method Details
-
fromUrl
- 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
-
withScheme
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
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
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
- Specified by:
withIpAddress
in interfaceorg.refcodes.net.IpAddressAccessor.IpAddressBuilder<UrlBuilder>
-
withCidrNotation
- Specified by:
withCidrNotation
in interfaceorg.refcodes.net.IpAddressAccessor.IpAddressBuilder<UrlBuilder>
-
withPort
- Specified by:
withPort
in interfaceorg.refcodes.mixin.PortAccessor.PortBuilder<UrlBuilder>
-
withPath
- Specified by:
withPath
in interfaceorg.refcodes.mixin.PathAccessor.PathBuilder<UrlBuilder>
-
appendToPath
Appends a path element to the path.- Parameters:
aPathElement
- The path element to be appended.
-
appendToPath
Appends multiple path elements to the path, automatically adding the path separator "/" as required.- Parameters:
aPathElements
- The path elements to be appended.
-
withAppendToPath
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
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
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
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
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
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
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
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
- Specified by:
withIdentity
in interfaceorg.refcodes.mixin.IdentityAccessor.IdentityBuilder<UrlBuilder>
-
withSecret
- 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
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
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
-
setQueryFields
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
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
- Specified by:
setIdentity
in interfaceorg.refcodes.mixin.IdentityAccessor.IdentityMutator
-
setSecret
- Specified by:
setSecret
in interfaceorg.refcodes.mixin.SecretAccessor.SecretMutator
-
toString
-