Package-level declarations

Types

Link copied to clipboard
interface AttributeHolder
Link copied to clipboard
interface Key

A key is a unique identifier for an attribute. It is used to store, retrieve and identify attributes. Keys are immutable and should be unique.

Link copied to clipboard
data class LongKey(val key: Long) : Key

A key that is identified by a long.

Link copied to clipboard
abstract class SimpleAttributeHolder(val attributeMap: MutableMap<Key, Any>) : AttributeHolder
Link copied to clipboard
data class StringKey(val key: String) : Key

A key that is identified by a string.

Functions

Link copied to clipboard
inline fun <T> AttributeHolder.getAttributeType(key: Key): T

Retrieves an attribute with the given key and casts it to the given type. If the attribute is not of the given type, a ClassCastException is thrown. If no attribute with the given key exists, an exception is thrown.

Link copied to clipboard
inline fun <T> AttributeHolder.getAttributeTypeOrDefault(key: Key, default: T): T

Retrieves an attribute with the given key and casts it to the given type. If the attribute is not of the given type, a ClassCastException is thrown. If no attribute with the given key exists, the default value is returned.

Link copied to clipboard

Retrieves an attribute with the given key and casts it to the given type. If the attribute is not of the given type, a ClassCastException is thrown. If no attribute with the given key exists, null is returned.