- All Known Subinterfaces:
UriQuery,UriQueryWriteable
public interface Parameters
Parameters abstraction (used by any component that has named parameters with possible multiple values).
This is a read-only access to the parameters.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GenericType<Parameters> Generic type for parameters. -
Method Summary
Modifier and TypeMethodDescriptionGet all values.Get all values using a default value supplier if the parameter does not exist.static Parameters.BuilderCreates a newParameters.BuilderofParameters.Name of the component of these parameters.booleanWhether these parameters contain the provided name.static ParametersRead only parameters based on a map.static ParameterscreateSingleValueMap(String component, Map<String, String> params) Read only parameters based on a map with just a single value.static ParametersCreate empty (named) parameters.Get the first value as an optional.Get the first value.default booleanisEmpty()Whether these parameters are empty.names()Set of parameter names.intsize()Number of parameter names in these parameters.toMap()Get a map representation of these parameters.
-
Field Details
-
GENERIC_TYPE
Generic type for parameters.
-
-
Method Details
-
builder
Creates a newParameters.BuilderofParameters.- Parameters:
component- component these parameters represent (such as request headers)- Returns:
- builder instance
-
empty
Create empty (named) parameters.- Parameters:
component- component of the parameters to correctly report errors- Returns:
- new named parameters with no values
-
create
Read only parameters based on a map.- Parameters:
component- component of the parameters to correctly report errorsparams- underlying map- Returns:
- new named parameters with values based on the map
-
createSingleValueMap
Read only parameters based on a map with just a single value.- Parameters:
component- component of the parameters to correctly report errorsparams- underlying map- Returns:
- new named parameters with values based on the map
-
all
Get all values.- Parameters:
name- name of the parameter- Returns:
- all values as a list
- Throws:
NoSuchElementException- in case the name is not present
-
all
Get all values using a default value supplier if the parameter does not exist.- Parameters:
name- name of the parameterdefaultValues- default values supplier to use if parameter is not present- Returns:
- all values as a list
-
get
Get the first value.- Parameters:
name- name of the parameter- Returns:
- first value
- Throws:
NoSuchElementException- in case the name is not present
-
first
Get the first value as an optional. Managing optionals has performance impact. If performance is of issue, usecontains(String)andget(String)instead.- Parameters:
name- name of the parameter- Returns:
- first value or empty optional
-
contains
Whether these parameters contain the provided name.- Parameters:
name- name of the parameter- Returns:
trueif the parameter is present,falseotherwise
-
isEmpty
default boolean isEmpty()Whether these parameters are empty.- Returns:
trueif there is no parameter defined
-
size
int size()Number of parameter names in these parameters.- Returns:
- size of these parameters
-
names
Set of parameter names.- Returns:
- names available in these parameters
-
component
String component()Name of the component of these parameters.- Returns:
- component name
-
toMap
Get a map representation of these parameters. Changes to the map will not be propagated to this instance.- Returns:
- a new map
-