MutableNovaRegistry

A mutable NovaRegistry that allows registering entries and tags via set. After initialization, the registry can be frozen to prevent further modifications and bind values to entries.

Some registries may be reloadable, allowing reload to reconfigure the registered contents of the registry. Corresponding entries and entry sets will be updated accordingly.

Properties

Link copied to clipboard

A set containing all entries in this registry.

Link copied to clipboard
abstract val isReloadable: Boolean

Whether the registry is reloadable, i.e. whether it can be reset and modified after being frozen.

Link copied to clipboard
abstract val key: Key

The key of this registry.

Link copied to clipboard
abstract val tags: Provider<Set<RegistryEntrySet.Nova.Tag<T>>>

A provider containing all tags in this registry.

Link copied to clipboard

An unmodifiable view of this registry.

Functions

Link copied to clipboard
abstract operator fun contains(value: T): Boolean

Checks whether the given value is registered in this registry.

abstract operator fun contains(key: Key): Boolean

Checks whether a value is registered under the given key.

Link copied to clipboard
abstract fun freeze()

Freezes the registry. This binds RegistryEntries to their values and prevents any further modifications to the registry. Requires prior registration of all elements and tags referenced in entries and entry sets.

Link copied to clipboard
abstract operator fun get(key: Key): RegistryEntry.Nova<T>

Gets an entry for the given key. This function may be used before registries are frozen (i.e. during bootstrap) and before the actual value is available. Attempting to resolve the entry's value before registry freeze will throw an exception. If no entry was registered under key, registry freezing will fail.

Link copied to clipboard
abstract fun getOptional(key: Key): Provider<RegistryEntry.Nova<T>?>

Gets a provider that contains an entry as resolved from get or null if no entry exists for the given key. This function may be used before registries are frozen (i.e. during bootstrap) and before the actual value is available.

Link copied to clipboard
abstract fun getOptionalTag(key: Key): Provider<RegistryEntrySet.Nova.Tag<T>?>

Gets a provider that contains an entry set like the one resolved from getTag or null if no tag exists for the given key. This function may be used before registries are frozen (i.e. during bootstrap) and before the actual tag is available.

Link copied to clipboard
abstract fun getTag(key: Key): RegistryEntrySet.Nova.Tag<T>

Gets an entry set containing all entries of the tag with the given key. This function may be used before registries are frozen (i.e. during bootstrap) and before the actual tag is available. Attempting to resolve the entry set's contents before registry freeze will throw an exception. If no tag was registered under key, registry freezing will fail.

Link copied to clipboard
abstract fun getValue(key: Key): T?

Gets the value registered under key, or null if no value exists.

Link copied to clipboard
open fun getValueOrThrow(key: Key): T

Gets the value registered under key, or throws an exception if no value exists.

Link copied to clipboard
abstract fun getValuesByName(name: String): List<T>

Gets all entries with the given name, ignoring their namespace.

Link copied to clipboard
abstract fun reload(configure: MutableNovaRegistry<T>.() -> Unit)

Atomically reloads the registry by:

Link copied to clipboard
abstract operator fun set(key: Key, value: T)

Registers value under key.

abstract operator fun set(tagKey: Key, entries: Provider<Set<NovaTagEntry<T>>>)

Registers a tag of entries under tagKey. Changes to entries are reflected in the tag and in all tags that include it.

Link copied to clipboard
abstract fun setKnown(key: Key)

Marks key as having been registered previously. If an unknown-entry factory is configured, it will be used to create values for unregistered known keys. Does nothing otherwise.