Package ovh.paulem.arcana.registry
Class AbstractRegistry<T extends RegistryKey<K>,K>
java.lang.Object
ovh.paulem.arcana.registry.AbstractRegistry<T,K>
- Type Parameters:
T- the type
- All Implemented Interfaces:
Registry<T,K>
- Direct Known Subclasses:
FrozenRegistry,WriteableRegistry
public abstract class AbstractRegistry<T extends RegistryKey<K>,K>
extends Object
implements Registry<T,K>
A basic abstract implementation of Registry
- Since:
- 1.0.0-SNAPSHOT
-
Field Summary
Fields -
Constructor Summary
Constructors -
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 registry
-
Field Details
-
registry
-
-
Constructor Details
-
AbstractRegistry
-
-
Method Details
-
get
Description copied from interface:RegistryFetches an entry from the registry -
getOrNull
Description copied from interface:RegistryFetches an entry from the registry -
getOrDefault
Description copied from interface:RegistryFetches the value at the given key or a provided default key- Specified by:
getOrDefaultin interfaceRegistry<T extends RegistryKey<K>,K> - 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
Description copied from interface:RegistryFetches the value at the given key or a provided default key- Specified by:
getOrDefaultin interfaceRegistry<T extends RegistryKey<K>,K> - 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
Description copied from interface:RegistryFetches an entry from the registry using the specified key or throws an exception if no entry exists.- Specified by:
getOrThrowin interfaceRegistry<T extends RegistryKey<K>,K> - Parameters:
key- the key to fetch the entry from the registry- Returns:
- the entry corresponding to the specified key
-
keys
Description copied from interface:RegistryRetrieves a set of all keys from the registry
-