Package net.paulem.arcana.registry
Interface Registry<T extends RegistryKey<K>,K>
- All Known Implementing Classes:
AbstractRegistry,FrozenRegistry,NewFrozenRegistry,WriteableRegistry
public interface Registry<T extends RegistryKey<K>,K>
Represents a basic registry object which contained
RegistryKey objects- Since:
- 1.0.0-SNAPSHOT
-
Method Summary
Modifier and TypeMethodDescriptionFetches an entry from the registrygetOrDefault(K key, @NotNull Supplier<T> defaultValue) Fetches the value at the given key or a provided default keygetOrDefault(K key, T defaultValue) Fetches the value at the given key or a provided default keyFetches an entry from the registrygetOrThrow(K key) Fetches an entry from the registry using the specified key or throws an exception if no entry exists.keys()Retrieves a set of all keys from the registrystatic <T extends RegistryKey<K>,K>
FrozenRegistry<T, K> Creates a new FrozenRegistry with the given datastatic <T extends RegistryKey<K>,K>
WriteableRegistry<T, K> newWriteable(Supplier<Map<K, T>> data) Creates a new WriteableRegistry with the given data
-
Method Details
-
newWriteable
Creates a new WriteableRegistry with the given data- Type Parameters:
T- the typeK- the key type- Parameters:
data- the data- Returns:
- the newly created WriteableRegistry
- Since:
- 1.0.0-SNAPSHOT
-
newFrozen
Creates a new FrozenRegistry with the given data- Type Parameters:
T- the typeK- the key type- Parameters:
data- the data- Returns:
- the newly created FrozenRegistry
- Since:
- 1.0.0-SNAPSHOT
-
get
Fetches an entry from the registry- Parameters:
key- the key to use to fetch the entry- Returns:
- an optional wrapping the nullable result
- Since:
- 1.0.0-SNAPSHOT
-
getOrNull
Fetches an entry from the registry- Parameters:
key- the key to use to fetch the entry- Returns:
- the resulting object at that key, or null if it doesn't exist
- Since:
- 1.0.0-SNAPSHOT
-
getOrDefault
Fetches the value at the given key or a provided default key- Parameters:
key- the keydefaultValue- the default value given the key has no value- Returns:
- a non null value from either the key or default
-
getOrDefault
Fetches the value at the given key or a provided default key- Parameters:
key- the keydefaultValue- the default value function triggered if the key has no value- Returns:
- a non null value from either the key or default
-
getOrThrow
Fetches an entry from the registry using the specified key or throws an exception if no entry exists.- Parameters:
key- the key to fetch the entry from the registry- Returns:
- the entry corresponding to the specified key
- Throws:
IllegalArgumentException- if no entry exists for the specified key
-
keys
Retrieves a set of all keys from the registry- Returns:
- a set of string keys
- Since:
- 1.0.0-SNAPSHOT
-