Interface MaterialObserver

All Known Implementing Classes:
AnalyticsObserver, AuditLogObserver, InventoryObserver

public interface MaterialObserver
Observer interface for material-related events in the Observer pattern. Defines the contract for objects that need to be notified of material events.

This interface allows components to subscribe to material events and be automatically notified when events occur, enabling loose coupling between the event source and event handlers.

Since:
2024-09-15
Version:
3.0
Author:
Navid Mohaghegh
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Gets the name of this observer for identification purposes.
    default void
    Called when the observer is added to a subject.
    void
    Called when a material event occurs.
    default void
    Called when the observer is removed from a subject.
  • Method Details

    • onEvent

      void onEvent(MaterialEvent event)
      Called when a material event occurs.
      Parameters:
      event - the material event that occurred
    • getObserverName

      default String getObserverName()
      Gets the name of this observer for identification purposes.
      Returns:
      the observer name
    • onAdded

      default void onAdded(MaterialSubject subject)
      Called when the observer is added to a subject. Can be used for initialization or setup.
      Parameters:
      subject - the subject this observer was added to
    • onRemoved

      default void onRemoved(MaterialSubject subject)
      Called when the observer is removed from a subject. Can be used for cleanup.
      Parameters:
      subject - the subject this observer was removed from