Class Parameters
-
- All Implemented Interfaces:
-
io.zenoh.query.IntoParameters
public final class Parameters implements IntoParameters
Parameters of the Selector.
A thin facade over the shared string-backed implementation (io.zenoh.jni.query.Parameters), which mirrors Rust's
zenoh::query::Parametersexactly. The string form follows thea=b;c=d|e;f=gformat:parameters are separated by
;(empty chunks are skipped),the parameter name and value are separated by the first
=,in the absence of
=, the parameter value is considered to be the empty string,the value is taken verbatim (no percent-decoding),
a duplicated parameter name is allowed: get returns the FIRST occurrence, and the duplicates survive round-tripping until an insert/remove normalizes the string.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classParameters.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static Parameters.CompanionCompanion
-
Method Summary
Modifier and Type Method Description StringtoString()Parametersinto()final BooleanisEmpty()Returns empty if no parameters were provided. final BooleancontainsKey(String key)Returns true if the key is contained. final Stringget(String key)Returns the value of the key if present (the first occurrence wins). final StringgetOrDefault(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 Stringinsert(String key, String value)Inserts the key-value pair into the parameters, returning the old value in case of it being already present. final Stringremove(String key)Removes the key parameter, returning its value. final Unitextend(IntoParameters parameters)Extends the parameters with the parameters provided, overwriting any conflicting params. final Unitextend(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. Booleanequals(Object other)IntegerhashCode()-
-
Method Detail
-
into
Parameters into()
-
containsKey
final Boolean containsKey(String key)
Returns true if the key is contained.
-
get
final String get(String key)
Returns the value of the key if present (the first occurrence wins).
-
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.
-
toMap
final Map<String, String> toMap()
Returns a map with the key value pairs of the parameters. For a duplicated key the last occurrence wins (unlike get).
-
-
-
-