1234567891011121314 |
- # factoryRegistry.py
- class FactoryRegistry:
- _factories = {}
- @classmethod
- def register_factory(cls, entity_type, factory_func):
- cls._factories[entity_type] = factory_func
- @classmethod
- def get_factory(cls, entity_type):
- factory = cls._factories.get(entity_type)
- if not factory:
- raise ValueError(f"No factory registered for type: {entity_type}")
- return factory
|