getOrDefault

fun <T> getOrDefault(key: AttributeKey<T>): T

Retrieves the attribute value for the specified key. If not set, it returns the AttributeKey.defaultValue defined in the key.