public abstract class ActionParameters internal constructor()
Action parameters, used to pass information to an Action.
Construct action parameters using actionParametersOf or mutableActionParametersOf, with typed key-value pairs. The Key class enforces typing of the values inserted.
Functions
contains
public abstract operator fun <T : Any> contains(key: Key<T>): Boolean
Returns true if the Parameters set contains the given Key.
Parameters
| key | the key to check for |
get
public abstract operator fun <T : Any> get(key: Key<T>): T?
Get a parameter with a key. If the key is not set, returns null.
Parameters
| T | the type of the parameter |
| key | the key for the parameter |
Throws: ClassCastException
if there is something stored with the same name as key but it cannot be cast to T
getOrDefault
public abstract fun <T : Any> getOrDefault(key: Key<T>, defaultValue: @UnsafeVariance T): T
Get a parameter with a key. If the key is not set, returns the provided default value.
Parameters
| T | the type of the parameter |
| key | the key for the parameter |
| defaultValue | the default value to return if key is missing |
Throws: ClassCastException
if there is something stored with the same name as key but it cannot be cast to T
asMap
public abstract fun asMap(): Map<Key<out Any>, Any>
Retrieves a map of all key value pairs. The map is unmodifiable, and attempts to mutate it will throw runtime exceptions.
Return
a map of all parameters in this Parameters
isEmpty
public abstract fun isEmpty(): Boolean
Returns whether there are any keys stored in the parameters.
Members
Key
public class Key<T : Any>(public val name: String)
Key for ActionParameters values. Type T is the type of the associated value. T must be a primitive or Parcelable type. The Key.name must be unique, keys with the same name are considered equal.
Functions
to
public infix fun to(value: T): Pair<T>
Infix function to create a Parameters.Pair.
Parameters
| value | the value this key should point to |
equals
override fun equals(other: Any?): Boolean
hashCode
override fun hashCode(): Int
toString
override fun toString(): String
Pair
public class Pair<T : Any> internal constructor(internal val key: Key<T>, internal val value: T)
Key Value pairs for Parameters. Type T is the type of the value. Pairs must have unique keys, or they will be considered equal.
Create this using the infix function to.
Functions
equals
override fun equals(other: Any?): Boolean
hashCode
override fun hashCode(): Int
toString
override fun toString(): String