java.lang.Object
io.github.astrapi69.design.pattern.observer.exception.ExceptionObservers

public class ExceptionObservers extends Object
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 Details

    • exceptionListeners

      protected List<ExceptionListener> exceptionListeners
      The list of registered exception listeners
  • Method Details

    • getInstance

      public static ExceptionObservers getInstance()
      Gets the single instance of ExceptionObservers
      Returns:
      the single instance of ExceptionObservers
    • addExceptionListener

      public void addExceptionListener(ExceptionListener listener)
      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

      public void removeExceptionListener(ExceptionListener listener)
      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