Class Parameters
-
- All Implemented Interfaces:
-
io.zenoh.query.IntoParameters
public final class Parameters implements IntoParameters
Parameters of the Selector.
When in string form, the
parameters
should be encoded like the query section of a URL:parameters are separated by
;
,the parameter name and value are separated by the first
=
,in the absence of
=
, the parameter value is considered to be the empty string,both name and value should use percent-encoding to escape characters,
defining a value for the same parameter name twice is considered undefined behavior and an error result is returned.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
Parameters.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static Parameters.Companion
Companion
-
Method Summary
Modifier and Type Method Description String
toString()
Parameters
into()
final Boolean
isEmpty()
Returns empty if no parameters were provided. final Boolean
containsKey(String key)
Returns true if the key is contained. final String
get(String key)
Returns the value of the key if present. final String
getOrDefault(String key, String default)
Returns the value of the key if present, or if not, the default value provided. final List<String>
values(String key)
Returns the values of the key if present. final String
insert(String key, String value)
Inserts the key-value pair into the parameters, returning the old value in case of it being already present. final String
remove(String key)
Removes the key parameter, returning its value. final Unit
extend(IntoParameters parameters)
Extends the parameters with the parameters provided, overwriting any conflicting params. final Unit
extend(Map<String, String> parameters)
Extends the parameters with the parameters provided, overwriting any conflicting params. final Map<String, String>
toMap()
Returns a map with the key value pairs of the parameters. -
-
Method Detail
-
into
Parameters into()
-
containsKey
final Boolean containsKey(String key)
Returns true if the key is contained.
-
getOrDefault
final String getOrDefault(String key, String default)
-
values
final List<String> values(String key)
Returns the values of the key if present.
Example:
var parameters = Parameters.from("a=1;b=2;c=1|2|3"); assertEquals(List.of("1", "2", "3"), parameters.values("c"))
-
insert
final String insert(String key, String value)
Inserts the key-value pair into the parameters, returning the old value in case of it being already present.
-
extend
final Unit extend(IntoParameters parameters)
Extends the parameters with the parameters provided, overwriting any conflicting params.
-
extend
final Unit extend(Map<String, String> parameters)
Extends the parameters with the parameters provided, overwriting any conflicting params.
-
-
-
-