| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<String,C> |
configurations |
protected RegistryStore<E> |
entries |
protected cn.sliew.milky.registry.AbstractRegistry.CompositeRegistryListener<E> |
listeners |
| Constructor and Description |
|---|
AbstractRegistry() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguration(String configName,
C configuration)
Adds a configuration to the registry.
|
protected E |
computeIfAbsent(String name,
Supplier<E> supplier) |
boolean |
exist(String name)
Return named entry whether exists in the Registry.
|
Optional<E> |
find(String name)
Find a named entry in the Registry
|
Optional<C> |
getConfiguration(String configName)
Get a configuration by name
|
Iterator<E> |
iterator() |
void |
registerListener(RegistryListener<E> listener)
Register entry event such as add, remove or replace
|
Optional<E> |
remove(String name)
Remove an entry from the Registry
|
Optional<E> |
replace(String name,
E newEntry)
Replace an existing entry in the Registry by a new one.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDefaultConfigforEach, spliteratorprotected final RegistryStore<E> entries
protected final ConcurrentMap<String,C> configurations
protected final cn.sliew.milky.registry.AbstractRegistry.CompositeRegistryListener<E> listeners
public Optional<E> find(String name)
Registrypublic Optional<E> remove(String name)
Registrypublic Optional<E> replace(String name, E newEntry)
Registrypublic boolean exist(String name)
Registrypublic void addConfiguration(String configName, C configuration)
RegistryaddConfiguration in interface Registry<E,C>configName - the configuration nameconfiguration - the added configurationpublic Optional<C> getConfiguration(String configName)
RegistrygetConfiguration in interface Registry<E,C>configName - the configuration namepublic void registerListener(RegistryListener<E> listener)
RegistryregisterListener in interface Registry<E,C>listener - the listenerCopyright © 2022. All rights reserved.