MutableRegisteringMap

@ApiStatus.Experimental
@ApiStatus.AvailableSince(value = "5.0.0")
open class MutableRegisteringMap<K : Any, V : Any> : RegisteringMap<K, V>

A collection that contains registrable values

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun containsKey(key: K): Boolean
Link copied to clipboard
Link copied to clipboard
operator fun get(key: K): V?
Link copied to clipboard
fun getRegistered(): ImmutableMap<K, V>

fun getRegistered(descriptor: K): Option<V>

Attempts to get the value with the given descriptor.

Link copied to clipboard
fun put(descriptor: K, loadable: Loadable<V>): Boolean

Puts a loadable entry to this map.

suspend fun put(descriptor: K, loader: suspend () -> V, unload: suspend V.() -> Unit = {}): Boolean

Puts a new entry to this map.

Link copied to clipboard
fun register(descriptor: K): Result<V>

Attempts to register the value with the given descriptor.

Link copied to clipboard
fun remove(descriptor: K): Boolean

Removes an entry from this map. If this entry is registered, it will be unloaded.

Link copied to clipboard
suspend fun tryRegisterAll(): ImmutableSet<V>

Attempts to register all still unregistered values.

Link copied to clipboard
suspend fun unregister(descriptor: K): Boolean

Attempts to register the value with the given descriptor.

Link copied to clipboard
suspend fun unregisterAll(): ImmutableSet<K>

Unregisters all registered values.

Properties

Link copied to clipboard
val entries: ImmutableSet<Map.Entry<K, V>>
Link copied to clipboard
val keys: ImmutableSet<K>

An ImmutableSet of the keys in this map.

Link copied to clipboard
val size: Int

The size of this map.

Link copied to clipboard
val values: ImmutableCollection<V>

An ImmutableCollection of the registered values.