Attributes

interface Attributes

Map of attributes accessible by AttributeKey in a typed manner

Inheritors

Properties

Link copied to clipboard
abstract val allKeys: List<AttributeKey<*>>

Returns List of all AttributeKey instances in this map

Functions

Link copied to clipboard
abstract fun <T : Any> computeIfAbsent(key: AttributeKey<T>, block: () -> T): T

Gets a value of the attribute for the specified key, or calls supplied block to compute its value

Link copied to clipboard
abstract operator fun contains(key: AttributeKey<*>): Boolean

Checks if an attribute with the specified key exists

Link copied to clipboard
open operator fun <T : Any> get(key: AttributeKey<T>): T

Gets a value of the attribute for the specified key, or throws an exception if an attribute doesn't exist

Link copied to clipboard
abstract fun <T : Any> getOrNull(key: AttributeKey<T>): T?

Gets a value of the attribute for the specified key, or return null if an attribute doesn't exist

Link copied to clipboard
abstract fun <T : Any> put(key: AttributeKey<T>, value: T)

Creates or changes an attribute with the specified key using value

Link copied to clipboard

Adds all attributes from another collection, replacing original values if any.

Link copied to clipboard
abstract fun <T : Any> remove(key: AttributeKey<T>)

Removes an attribute with the specified key

Link copied to clipboard
open fun <T : Any> take(key: AttributeKey<T>): T

Removes an attribute with the specified key and returns its current value, throws an exception if an attribute doesn't exist

Link copied to clipboard
open fun <T : Any> takeOrNull(key: AttributeKey<T>): T?

Removes an attribute with the specified key and returns its current value, returns null if an attribute doesn't exist