public abstract class MultiValueRequestParameters extends Object implements RequestParameters
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_TYPE
Service type parameter identifier for OWS requests,
e.g. set to "SOS" for Sensor Observation Service requests.
|
static String |
SERVICE_VERSION
Service version parameter identifier for OWS requests, e.g. set to "1.0.0"
for version 1.0.0 requests of a specific service interface.
|
Constructor and Description |
---|
MultiValueRequestParameters() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addNonEmpty(String key,
Collection<String> values) |
protected boolean |
addNonEmpty(String key,
String value)
Adds a required parameter to the map doing a non-null check beforehand.
|
boolean |
addParameterEnumValues(String parameter,
Enum<?>... values)
Adds a bulk of parameter values (from a particular codelist) to the given parameter.
|
boolean |
addParameterStringValues(String parameter,
String... values)
Adds a bulk of parameter values to the given parameter.
|
boolean |
addParameterValue(String parameter,
String value)
Adds a new parameter value to the given parameter.
|
boolean |
addParameterValues(String parameter,
Iterable<String> values)
Adds a bulk of parameter values to the given parameter.
|
boolean |
contains(String parameter)
Checks if the given parameter is present in the assembly.
|
Collection<String> |
getAllValues(String parameter)
Get read-only access to all parameter values associated with the given parameter.
|
Collection<String> |
getParameterNames()
Returns all parameter names available in this parameter assembly.
|
String |
getSingleValue(String parameter)
Gets the first parameter value for the given parameter.
|
boolean |
hasMultipleValues(String parameter)
Checks if the assembly has more than one parameter value associated to the given key.
|
boolean |
isEmpty()
Checks if the assembly is empty at all.
|
boolean |
isEmpty(String parameter)
Checks if the given parameter has at least one associated value.
|
protected boolean |
isEmptyString(String value) |
protected boolean |
isEmptyValue(String parameter)
Checks if value of the given parameter is empty.
|
boolean |
isSingleValue(String parameter)
Checks if the assembly has exact one parameter value associated to the given key.
|
boolean |
mergeWith(RequestParameters parameters)
Merge the given parameter assembly with this instance.
|
Collection<String> |
remove(String parameter)
Removes the given parameter and its associated values.
|
void |
removeAll()
Performs a complete clean of this assembly instance.
|
public static final String SERVICE_VERSION
public static final String SERVICE_TYPE
public boolean isEmpty()
RequestParameters
isEmpty
in interface RequestParameters
true
if there are no key-value pairs available,false
if the assembly contains at least one key-value pair.public boolean isEmpty(String parameter)
RequestParameters
isEmpty
in interface RequestParameters
parameter
- the parameter key to check.true
if the passed parameter has zero associated values
or is not present in the assembly,false
if the parameter is has one or more associated values.public boolean contains(String parameter)
RequestParameters
contains
in interface RequestParameters
parameter
- the parameter key to check.true
if the passed parameter has one or more associated value(s),false
if parameter is not present.public boolean isSingleValue(String parameter)
RequestParameters
false
. This method is not threadsafe, so do not
expect it as a reliable check; other threads may have added new values in the meantime.isSingleValue
in interface RequestParameters
parameter
- the parameter key to check.true
if there is exact one value associated with the given parameter,false
if there are more than one parameter value, or the parameter is not present.public boolean hasMultipleValues(String parameter)
RequestParameters
false
. This method is not threadsafe, so do not
expect it as a reliable check; other threads may have added new values in the meantime.hasMultipleValues
in interface RequestParameters
parameter
- the parameter key to check.true
if more than one value is associated with the given parameter,false
if there is only one parameter value, or the parameter is not present.public String getSingleValue(String parameter)
RequestParameters
null
value
associated to it an empty string "" will be returned. Use RequestParameters.contains(String)
to
ensure if the parameter is contained by this assembly.getSingleValue
in interface RequestParameters
parameter
- the parameter key to check.RequestParameters.contains(String)
public Collection<String> getParameterNames()
RequestParameters
getParameterNames
in interface RequestParameters
public Collection<String> getAllValues(String parameter)
RequestParameters
getAllValues
in interface RequestParameters
parameter
- the parameter key to check.public boolean mergeWith(RequestParameters parameters)
RequestParameters
mergeWith
in interface RequestParameters
parameters
- the parameter assembly to merge with.true
if the assembly has changed,false
otherwise.public boolean addParameterValue(String parameter, String value)
RequestParameters
RequestParameters.remove(String)
.null
values are stored as empty Strings.addParameterValue
in interface RequestParameters
parameter
- the parameter key.value
- the value to associate the with parameter.true
if the assembly has changed (size has increased).public boolean addParameterEnumValues(String parameter, Enum<?>... values)
RequestParameters
RequestParameters.remove(String)
.null
values are stored as empty Strings.addParameterEnumValues
in interface RequestParameters
parameter
- the parameter key.values
- the Enum.toString()
values to associate with the parameter.true
if the assembly has changed (size has increased).public boolean addParameterStringValues(String parameter, String... values)
RequestParameters
RequestParameters.remove(String)
.null
values are stored as empty Strings.addParameterStringValues
in interface RequestParameters
parameter
- the parameter key.values
- the values to associate with the parameter.true
if the assembly has changed (size has increased).public boolean addParameterValues(String parameter, Iterable<String> values)
RequestParameters
RequestParameters.remove(String)
.null
values are stored as empty Strings.addParameterValues
in interface RequestParameters
parameter
- the parameter key.values
- the values to associate with the parameter.true
if the assembly has changed (size has increased).public Collection<String> remove(String parameter)
RequestParameters
remove
in interface RequestParameters
parameter
- the parameter key.public void removeAll()
RequestParameters
removeAll
in interface RequestParameters
protected boolean addNonEmpty(String key, String value)
key
- the parameter's name.value
- the non-null value.IllegalArgumentException
- if the parameter value
is null
or empty.protected boolean addNonEmpty(String key, Collection<String> values)
protected boolean isEmptyValue(String parameter)
parameter
- the parameter name.true
if parameter value is null
or empty, false
otherwise.protected boolean isEmptyString(String value)
Copyright © 2012–2017 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.