factoryRegistry.py 424 B

1234567891011121314
  1. # factoryRegistry.py
  2. class FactoryRegistry:
  3. _factories = {}
  4. @classmethod
  5. def register_factory(cls, entity_type, factory_func):
  6. cls._factories[entity_type] = factory_func
  7. @classmethod
  8. def get_factory(cls, entity_type):
  9. factory = cls._factories.get(entity_type)
  10. if not factory:
  11. raise ValueError(f"No factory registered for type: {entity_type}")
  12. return factory