java.lang.Object
io.helidon.common.http.ReadOnlyParameters
- Direct Known Subclasses:
ReadOnlyHeaders
An immutable implementation of
Parameters
.- See Also:
-
Constructor Summary
ModifierConstructorDescriptionReadOnlyParameters
(Parameters parameters) Creates an instance from provided multi-map.protected
ReadOnlyParameters
(Map<String, List<String>> data) Creates an instance from provided multi-map. -
Method Summary
Modifier and TypeMethodDescriptionAdds specified values to association with the specified key (optional operation).Adds specified values to association with the specified key (optional operation).addAll
(Parameters parameters) Copies all of the mappings from the specifiedparameters
to this instance adding values to existing associations (optional operation).Returns an unmodifiable List of all of the values of the given named parameter.If the specified key is not already associated with a value computes new association using the given function and returns emptyList
, else returns the current value (optional operation).computeSingleIfAbsent
(String key, Function<String, String> value) If the specified key is not already associated with a value computes new association using the given function and returns emptyList
, else returns the current value (optional operation).static ReadOnlyParameters
empty()
Returns empty and immutable singleton.emptyMap()
Creates an emptyMap
suitable (once populated) for read-only access.Creates an emptyMap
suitable (once populated) for read-only access, pre-sized as specified.Returns anOptional
containing the first value of the given parameter (and possibly multi-valued) parameter.iterator()
Associates specified values with the specified key (optional operation).Associates specified values with the specified key (optional operation).putAll
(Parameters parameters) Copies all of the mappings from the specifiedparameters
to this instance replacing values of existing associations (optional operation).putIfAbsent
(String key, Iterable<String> values) If the specified key is not already associated with a value associates it with the given value and returns emptyList
, else returns the current value (optional operation).putIfAbsent
(String key, String... values) If the specified key is not already associated with a value associates it with the given value and returns emptyList
, else returns the current value (optional operation).Removes the mapping for a key if it is present (optional operation).toMap()
Returns a copy of parameters as a Map.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ReadOnlyParameters
Creates an instance from provided multi-map.- Parameters:
data
- multi-map data to copy.
-
ReadOnlyParameters
Creates an instance from provided multi-map.- Parameters:
parameters
- parameters to copy.
-
ReadOnlyParameters
-
-
Method Details
-
empty
Returns empty and immutable singleton.- Returns:
- the parameters singleton instance which is empty and immutable.
-
first
Description copied from interface:Parameters
Returns anOptional
containing the first value of the given parameter (and possibly multi-valued) parameter. If the parameter is not present, then the returned Optional is empty.- Specified by:
first
in interfaceParameters
- Parameters:
name
- the parameter name- Returns:
- an
Optional<V>
for the first named value
-
all
Description copied from interface:Parameters
Returns an unmodifiable List of all of the values of the given named parameter. Always returns a List, which may be empty if the parameter is not present.- Specified by:
all
in interfaceParameters
- Parameters:
name
- the parameter name- Returns:
- a
List
of values with zero or greater size
-
put
Description copied from interface:Parameters
Associates specified values with the specified key (optional operation). If parameters previously contained a mapping for the key, the old values fully replaced.- Specified by:
put
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be associated with the specified key- Returns:
- the previous values associated with key, or empty
List
if there was no mapping for key.
-
put
Description copied from interface:Parameters
Associates specified values with the specified key (optional operation). If parameters previously contained a mapping for the key, the old values fully replaced.- Specified by:
put
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be associated with the specified key. Ifnull
then association will be removed.- Returns:
- the previous values associated with key, or empty
List
if there was no mapping for key.
-
putIfAbsent
Description copied from interface:Parameters
If the specified key is not already associated with a value associates it with the given value and returns emptyList
, else returns the current value (optional operation).- Specified by:
putIfAbsent
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be associated with the specified key- Returns:
- the previous values associated with key, or empty
List
if there was no mapping for key.
-
putIfAbsent
Description copied from interface:Parameters
If the specified key is not already associated with a value associates it with the given value and returns emptyList
, else returns the current value (optional operation).- Specified by:
putIfAbsent
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be associated with the specified key- Returns:
- the previous values associated with key, or empty
List
if there was no mapping for key.
-
computeIfAbsent
Description copied from interface:Parameters
If the specified key is not already associated with a value computes new association using the given function and returns emptyList
, else returns the current value (optional operation).- Specified by:
computeIfAbsent
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be associated with the specified key- Returns:
- the current (potentially computed) values associated with key,
or empty
List
if function returnsnull
-
putAll
Description copied from interface:Parameters
Copies all of the mappings from the specifiedparameters
to this instance replacing values of existing associations (optional operation).- Specified by:
putAll
in interfaceParameters
- Parameters:
parameters
- to copy.- Returns:
- this instance of
Parameters
-
add
Description copied from interface:Parameters
Adds specified values to association with the specified key (optional operation). If parameters doesn't contains mapping, new mapping is created.- Specified by:
add
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be add to association with the specified key- Returns:
- this instance of
Parameters
-
add
Description copied from interface:Parameters
Adds specified values to association with the specified key (optional operation). If parameters doesn't contains mapping, new mapping is created.- Specified by:
add
in interfaceParameters
- Parameters:
key
- key with which the specified value is to be associatedvalues
- value to be add to association with the specified key. Ifnull
then noting will be add.- Returns:
- this instance of
Parameters
-
computeSingleIfAbsent
Description copied from interface:Parameters
If the specified key is not already associated with a value computes new association using the given function and returns emptyList
, else returns the current value (optional operation).- Specified by:
computeSingleIfAbsent
in interfaceParameters
- Parameters:
key
- a key with which the specified value is to be associatedvalue
- a single value to be associated with the specified key- Returns:
- the current (potentially computed) values associated with key,
or empty
List
if function returnsnull
-
addAll
Description copied from interface:Parameters
Copies all of the mappings from the specifiedparameters
to this instance adding values to existing associations (optional operation).- Specified by:
addAll
in interfaceParameters
- Parameters:
parameters
- to copy.- Returns:
- this instance of
Parameters
-
remove
Description copied from interface:Parameters
Removes the mapping for a key if it is present (optional operation).- Specified by:
remove
in interfaceParameters
- Parameters:
key
- key whose mapping is to be removed.- Returns:
- the previous value associated with key, or empty
List
.
-
toMap
Description copied from interface:Parameters
Returns a copy of parameters as a Map. This interface should only be used when it is required to iterate over the entire set of parameters.- Specified by:
toMap
in interfaceParameters
- Returns:
- the
Map
-
iterator
Description copied from interface:Parameters
Implementations should override this default with a more efficient implementation.
-
emptyMap
Creates an emptyMap
suitable (once populated) for read-only access.- Returns:
- empty
Map
-
emptyMapForCopy
Creates an emptyMap
suitable (once populated) for read-only access, pre-sized as specified.- Returns:
- empty
Map
, possibly pre-sized as indicated
-