MutableActionParameters
class MutableActionParameters : ActionParameters
| kotlin.Any | ||
| ↳ | androidx.glance.action.ActionParameters | |
| ↳ | androidx.glance.action.MutableActionParameters |
Mutable version of ActionParameters. Allows for editing the underlying data, and adding or removing key-value pairs.
Summary
Public functions |
|
|---|---|
open Map<ActionParameters.Key<Any>, Any> |
asMap()Retrieves a map of all key value pairs. |
Unit |
clear()Removes all parameters from this MutableParameters. |
open operator Boolean |
<T : Any> contains(key: ActionParameters.Key<T>)Returns true if the Parameters set contains the given Key. |
open operator Boolean |
|
open operator T? |
<T : Any> get(key: ActionParameters.Key<T>)Get a parameter with a key. |
open T |
<T : Any> getOrDefault(key: ActionParameters.Key<T>, defaultValue: T)Get a parameter with a key. |
open Int |
hashCode() |
open Boolean |
isEmpty()Returns whether there are any keys stored in the parameters. |
T? |
<T : Any> remove(key: ActionParameters.Key<T>)Removes an item from this MutableParameters. |
operator T? |
<T : Any> set(key: ActionParameters.Key<T>, value: T?)Sets a key value pair in MutableParameters. |
open String |
toString() |
Public functions
asMap
open fun asMap(): Map<ActionParameters.Key<Any>, Any>
Retrieves a map of all key value pairs. The map is unmodifiable, and attempts to mutate it will throw runtime exceptions.
| Returns | |
|---|---|
Map<ActionParameters.Key<Any>, Any> |
a map of all parameters in this Parameters |
contains
open operator fun <T : Any> contains(key: ActionParameters.Key<T>): Boolean
Returns true if the Parameters set contains the given Key.
| Parameters | |
|---|---|
key: ActionParameters.Key<T> |
the key to check for |
get
open operator fun <T : Any> get(key: ActionParameters.Key<T>): T?
Get a parameter with a key. If the key is not set, returns null.
| Parameters | |
|---|---|
<T : Any> |
the type of the parameter |
key: ActionParameters.Key<T> |
the key for the parameter |
| Throws | |
|---|---|
kotlin.ClassCastException |
if there is something stored with the same name as |
getOrDefault
open fun <T : Any> getOrDefault(key: ActionParameters.Key<T>, defaultValue: T): T
Get a parameter with a key. If the key is not set, returns the provided default value.
| Parameters | |
|---|---|
<T : Any> |
the type of the parameter |
key: ActionParameters.Key<T> |
the key for the parameter |
defaultValue: T |
the default value to return if key is missing |
| Throws | |
|---|---|
kotlin.ClassCastException |
if there is something stored with the same name as |
remove
fun <T : Any> remove(key: ActionParameters.Key<T>): T?
Removes an item from this MutableParameters.
| Parameters | |
|---|---|
key: ActionParameters.Key<T> |
the parameter to remove |
| Returns | |
|---|---|
T? |
the original value of the parameter |
set
operator fun <T : Any> set(key: ActionParameters.Key<T>, value: T?): T?
Sets a key value pair in MutableParameters. If the value is null, the key is removed from the parameters.
| Parameters | |
|---|---|
key: ActionParameters.Key<T> |
the parameter to set |
value: T? |
the value to assign to this parameter |
| Returns | |
|---|---|
T? |
the previous value associated with the key, or null if the key was not present |