Class ExceptionObservers
java.lang.Object
io.github.astrapi69.design.pattern.observer.exception.ExceptionObservers
The class
ExceptionObservers
is a singleton that manages a list of
ExceptionListener
objects It allows classes to register and unregister for exception
events, and notifies registered listeners when an exception event occurs-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ExceptionListener>
The list of registered exception listeners -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExceptionListener
(ExceptionListener listener) Adds the specified exception listener to the list of listeners This method allows classes to register for exception eventsstatic ExceptionObservers
Gets the single instance ofExceptionObservers
void
removeExceptionListener
(ExceptionListener listener) Removes the specified exception listener from the list of listeners This method allows classes to unregister for exception events
-
Field Details
-
exceptionListeners
The list of registered exception listeners
-
-
Method Details
-
getInstance
Gets the single instance ofExceptionObservers
- Returns:
- the single instance of
ExceptionObservers
-
addExceptionListener
Adds the specified exception listener to the list of listeners This method allows classes to register for exception events- Parameters:
listener
- the exception listener to be added
-
removeExceptionListener
Removes the specified exception listener from the list of listeners This method allows classes to unregister for exception events- Parameters:
listener
- the exception listener to be removed
-