ELEMENT
- OBSERVER
- public abstract class Registry<ELEMENT,OBSERVER extends ECPObserver> extends org.eclipse.net4j.util.lifecycle.Lifecycle implements ECPDisposable.DisposeListener
Constructor and Description |
---|
Registry()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(OBSERVER observer)
Adds an
ECPObserver to the ECPObserverBus . |
void |
changeElements(Set<String> remove,
Set<ELEMENT> add)
Adds or remove elements contained in the registry.
|
void |
disposed(ECPDisposable disposable)
Callback method being used to notify listeners about a dispose.
|
protected Set<ELEMENT> |
doChangeElements(Set<String> remove,
Set<ELEMENT> add)
Executes adding or removing elements contained in the registry.
|
protected void |
elementsChanged(Collection<ELEMENT> oldElements,
Collection<ELEMENT> newElements) |
ELEMENT |
getElement(String key)
Retrieves an element with a certain name from the registry.
|
int |
getElementCount()
Returns the number of elements managed by the registry.
|
protected abstract String |
getElementName(ELEMENT element) |
Set<String> |
getElementNames()
Returns the names of the elements managed by the registry.
|
Collection<ELEMENT> |
getElements()
Returns the list of elements managed by the registry.
|
boolean |
hasElement(String name)
Checks if an element with a certain name is managed by the registry.
|
boolean |
hasElements()
Returns if the registry has elements.
|
protected static boolean |
isDisposingElement() |
protected boolean |
isRemoveDisposedElements() |
protected abstract void |
notifyObservers(Collection<ELEMENT> oldArray,
Collection<ELEMENT> newArray)
Notifies observers that the elements in the registry have changed.
|
void |
removeObserver(OBSERVER observer)
Removes an
ECPObserver to the ECPObserverBus . |
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
public final ELEMENT getElement(String key)
key
- the name of the element to retrievepublic final Set<String> getElementNames()
public final int getElementCount()
public final Collection<ELEMENT> getElements()
public final boolean hasElements()
public final boolean hasElement(String name)
name
- the name of the element to checkpublic final void changeElements(Set<String> remove, Set<ELEMENT> add)
remove
- a set of elements to be removedadd
- a set of elements to be addedpublic final void disposed(ECPDisposable disposable)
disposed
in interface ECPDisposable.DisposeListener
disposable
- the object being disposedprotected boolean isRemoveDisposedElements()
protected final Set<ELEMENT> doChangeElements(Set<String> remove, Set<ELEMENT> add)
remove
- a set of elements to be removedadd
- a set of elements to be addedpublic void addObserver(OBSERVER observer)
ECPObserver
to the ECPObserverBus
.observer
- the observer to be addedpublic void removeObserver(OBSERVER observer)
ECPObserver
to the ECPObserverBus
.observer
- the observer to be removedprotected abstract void notifyObservers(Collection<ELEMENT> oldArray, Collection<ELEMENT> newArray) throws Exception
oldArray
- The old collection of elementsnewArray
- The new collection of elementsException
protected void elementsChanged(Collection<ELEMENT> oldElements, Collection<ELEMENT> newElements)
protected abstract String getElementName(ELEMENT element)
element
- the element to retrieve a name for.protected static boolean isDisposingElement()
Copyright © 2019. All rights reserved.