forked from p15670423/monkey
Common: Add EventSerializerRegistry
This commit is contained in:
parent
0b9191ca43
commit
141c766b51
|
@ -0,0 +1,17 @@
|
||||||
|
from common.event_serializers import IEventSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class EventSerializerRegistry:
|
||||||
|
"""
|
||||||
|
Registry for event serializers
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._registry = {}
|
||||||
|
|
||||||
|
def __setitem__(self, event_class_name: str, event_serializer: IEventSerializer):
|
||||||
|
self._registry[event_class_name] = event_serializer
|
||||||
|
|
||||||
|
def __getitem__(self, event_class_name: str):
|
||||||
|
event_serializer = self._registry[event_class_name]
|
||||||
|
return event_serializer
|
Loading…
Reference in New Issue