Package org.geysermc.geyser.registry
Class AbstractMappedRegistry<K,V,M extends Map<K,V>>
java.lang.Object
org.geysermc.geyser.registry.Registry<M>
org.geysermc.geyser.registry.AbstractMappedRegistry<K,V,M>
- Type Parameters:
K- the keyV- the valueM- the map
- Direct Known Subclasses:
MappedRegistry,PacketTranslatorRegistry,SimpleMappedRegistry,VersionedRegistry
An abstract registry holding a map of various registrations as defined by
AbstractMappedRegistry.
The M represents the map class, which can be anything that extends Map. The
AbstractMappedRegistry and AbstractMappedRegistry generics are the key and value respectively.-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMappedRegistry(I input, RegistryLoader<I,M> registryLoader) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value registered by the given key.getOrDefault(K key, V defaultValue)Returns the value registered by the given key or the default value specified if null.<U> Optional<U>Returns and maps the value by the given key if present.Registers a new value into this registry with the given key.
-
Constructor Details
-
AbstractMappedRegistry
-
-
Method Details
-
get
Returns the value registered by the given key.- Parameters:
key- the key- Returns:
- the value registered by the given key.
-
map
Returns and maps the value by the given key if present.- Type Parameters:
U- the type- Parameters:
key- the keymapper- the mapper- Returns:
- the mapped value from the given key if present
-
getOrDefault
Returns the value registered by the given key or the default value specified if null.- Parameters:
key- the keydefaultValue- the default value- Returns:
- the value registered by the given key or the default value specified if null.
-
register
Registers a new value into this registry with the given key.- Parameters:
key- the keyvalue- the value- Returns:
- a new value into this registry with the given key.
-