public class DefaultRegistryImpl<C> extends Object implements DefaultRegistry<C>
Registry type.
It's implemented for achieving an in-memory and lightweight registry approach, don't do an overuse of it.
Note: The Stack class behavior when using the iterator is not the expected one, so used
ArrayDeque instead of an Stack to provide right iteration order.| Constructor and Description |
|---|
DefaultRegistryImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the registry
|
List<C> |
getHistory()
Returns a
List containing all the items in the registry |
boolean |
isEmpty()
Determines if the registry is empty or not
|
C |
peek()
Peeks the last added item.
|
C |
pop()
Pops the last added item and removes it.
|
void |
register(C item)
Registers an item into the registry
|
void |
setMaxSize(int size)
Sets the max number of items that can be stored on the registry.
|
void |
setRegistryChangeListener(RegistryChangeListener registryChangeListener)
Sets a
RegistryChangeListener to be called when the registry changes. |
public void setMaxSize(int size)
RegistrysetMaxSize in interface Registry<C>size - A positive integerpublic void register(C item)
Registrypublic void clear()
Registrypublic List<C> getHistory()
RegistryList containing all the items in the registrygetHistory in interface Registry<C>List of containing the registered itemspublic void setRegistryChangeListener(RegistryChangeListener registryChangeListener)
RegistryRegistryChangeListener to be called when the registry changes.setRegistryChangeListener in interface Registry<C>registryChangeListener - A RegistryChangeListenerpublic C peek()
Registrypublic C pop()
RegistryCopyright © 2012–2020 JBoss by Red Hat. All rights reserved.