Class EntityGeneratorFactory

All Implemented Interfaces:
CommonFactory, ExtendedFactory, PrimitiveFactory, RegexFactory

@Component public class EntityGeneratorFactory extends GeneratorFactory
EntityGeneratorFactory is a registry and access point for EntityGenerator instances.

This factory maintains a mapping between entity classes and their corresponding EntityGenerator. It allows generators to be retrieved by entity type at runtime.

All EntityGenerators are registered during application initialization by EntityGeneratorInitializer.

  • Constructor Details

    • EntityGeneratorFactory

      public EntityGeneratorFactory()
  • Method Details

    • getGenerator

      public <T> EntityGenerator<T> getGenerator(Class<T> clazz)
      Returns the EntityGenerator associated with the given entity class.
      Type Parameters:
      T - the entity type
      Parameters:
      clazz - the entity class
      Returns:
      the corresponding entity generator
      Throws:
      GeneratorException - if no generator is registered for the class
    • getEntityGeneratorNames

      public List<Class<?>> getEntityGeneratorNames()
      Returns all entity classes for which generators are registered.
      Returns:
      a list of registered entity classes
    • registerAll

      public void registerAll(Map<Class<?>,EntityGenerator<?>> generators)
      Registers multiple EntityGenerator instances at once.
      Parameters:
      generators - a map of entity classes to generators