Package mocka.generator
Class EntityInstanceCreator
java.lang.Object
mocka.generator.EntityInstanceCreator
EntityInstanceCreator is responsible for creating entity instances
through the configured ORMCreator. It supports multiple ORM implementations and allows instance creation with different
GenerateType strategies.
This class is managed as a Spring Component and is typically
injected into factories or services that need entity instance generation.
-
Method Summary
Modifier and TypeMethodDescription<T> TcreateInstance(Class<T> clazz, GenerateType generateType) Creates an entity instance for the given class using the default ORM.<T> TcreateInstance(ORMType ormType, Class<T> clazz, GenerateType generateType) Creates an entity instance for the given class using a specific ORM implementation.
This method should be used when multiple ORM implementations are configured, and you want to explicitly select whichORMTypeshould be used for entity creation.
-
Method Details
-
createInstance
Creates an entity instance for the given class using the default ORM.
This method should be used when there is only one ORM implementation configured.If the
GenerateTypeisALL, all related entities (both parent and child relationships) are generated recursively. Otherwise, the instance is created according to the specified strategy.- Type Parameters:
T- the type of the entity- Parameters:
clazz- the class type of the entity to generategenerateType- the generation strategy (e.g.,GenerateType)- Returns:
- a new instance of the given entity class
-
createInstance
Creates an entity instance for the given class using a specific ORM implementation.
This method should be used when multiple ORM implementations are configured, and you want to explicitly select whichORMTypeshould be used for entity creation.If the
GenerateTypeisALL, all related entities (both parent and child relationships) are generated recursively. Otherwise, the instance is created according to the specified strategy.- Type Parameters:
T- the type of the entity- Parameters:
ormType- the ORM implementation type to useclazz- the class type of the entity to generategenerateType- the generation strategy (e.g., SINGLE, CHILD, PARENT, ALL)- Returns:
- a new instance of the given entity class
-