MutableDefaultBoundEntry

class MutableDefaultBoundEntry<P : Any, C : Any>(container: MutablePersistentDataContainer, key: String, type: PersistentDataType<P, C>, defaultValue: () -> C) : DefaultBoundEntry<P, C> (source)

Represents a mutable default-bound entry in a MutablePersistentDataContainer.

This class extends DefaultBoundEntry and allows for modification of the value associated with the specified key. The entry is bound to a key and a type within the container and provides a default value if the key does not exist.

It provides operations to update the bound value in the container using either the setValue operator or the set method.

Author

Fantamomo

Since

3.2-SNAPSHOT

Parameters

P

The primitive data type.

C

The complex data type.

key

The key associated with the value in the container.

type

The type used to serialize/deserialize the value.

defaultValue

A lambda function that provides the default value if the key does not exist.

Constructors

Link copied to clipboard
constructor(container: MutablePersistentDataContainer, key: String, type: PersistentDataType<P, C>, defaultValue: () -> C)

Properties

Link copied to clipboard
val defaultValue: () -> C

A lambda function that provides the default value if the key does not exist.

Link copied to clipboard
val key: String

The key associated with the value in the container.

Link copied to clipboard

The type used to serialize/deserialize the value.

Functions

Link copied to clipboard
open override fun get(): C

Retrieves the value associated with the specified key and type from the container.

Link copied to clipboard
open operator override fun getValue(thisRef: Any?, property: KProperty<*>): C

Retrieves the value associated with the given key and type from the container.

Link copied to clipboard
fun set(value: C)
Link copied to clipboard
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: C)