MutableActionParameters

class MutableActionParameters : ActionParameters


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>

Retrieves a map of all key value pairs.

Unit

Removes all parameters from this MutableParameters.

open operator Boolean

Returns true if the Parameters set contains the given Key.

open operator Boolean
equals(other: Any?)
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
open Boolean

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

Public functions

asMap

Added in 1.1.1
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

clear

Added in 1.0.0
fun clear(): Unit

Removes all parameters from this MutableParameters.

contains

Added in 1.1.1
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

equals

open operator fun equals(other: Any?): Boolean

get

Added in 1.1.1
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 key but it cannot be cast to T

getOrDefault

Added in 1.1.1
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 key but it cannot be cast to T

hashCode

open fun hashCode(): Int

isEmpty

Added in 1.1.1
open fun isEmpty(): Boolean

Returns whether there are any keys stored in the parameters.

remove

Added in 1.0.0
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

Added in 1.0.0
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

toString

open fun toString(): String