UserDataProperty¶
class UserDataProperty<in R : UserDataHolder, T : Any>(val key: Key<T>)
A property delegate that reads and writes a value stored in a UserDataHolder under the given key.
It lets user data — the platform's mechanism for attaching arbitrary values to a UserDataHolder such as a PSI element — be accessed as an ordinary, type-safe (nullable) Kotlin property.
Example:¶
private val KEY = Key.create<Boolean>("MY_FLAG")
var PsiElement.myFlag: Boolean? by UserDataProperty(KEY)
Type Parameters¶
-
R: the type of user-data holder this property applies to
-
T: the type of the stored value
Constructors¶
UserDataProperty¶
constructor(key: Key<T>)
Type Parameters
-
R: the type of user-data holder this property applies to
-
T: the type of the stored value