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 TypeMethodDescriptiondefault StringGets the name of this observer for identification purposes.default voidonAdded(MaterialSubject subject) Called when the observer is added to a subject.voidonEvent(MaterialEvent event) Called when a material event occurs.default voidonRemoved(MaterialSubject subject) Called when the observer is removed from a subject.
-
Method Details
-
onEvent
Called when a material event occurs.- Parameters:
event- the material event that occurred
-
getObserverName
Gets the name of this observer for identification purposes.- Returns:
- the observer name
-
onAdded
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
Called when the observer is removed from a subject. Can be used for cleanup.- Parameters:
subject- the subject this observer was removed from
-