NovaRegistry

A thread-safe storage for values identified by keys.

During initialization (bootstrap), elements of registries cannot be accessed. Instead, use registry entries and entry sets, which will be bound to the corresponding values upon registry freeze.

Elements of registries can be grouped together using tags, which are also identifiable by a Key.

Inheritors

Properties

Link copied to clipboard

A set containing all entries in this registry.

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.

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 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.