Package mocka.generator.orm
Class AbstractCreator
java.lang.Object
mocka.generator.orm.AbstractCreator
- Direct Known Subclasses:
HibernateCreator,MyBatisCreator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringhandleRegexSource(Field field) protected <T> ThandleValueSource(Field field) Handles field value generation for fields annotated withValueSource.protected <T> TinitInstance(Class<T> clazz)
-
Constructor Details
-
AbstractCreator
-
-
Method Details
-
handleValueSource
Handles field value generation for fields annotated withValueSource.This method resolves a generator from the
GeneratorRegistryusing the information provided in theValueSourceannotation. It follows a priority-based resolution strategy:- Generator Key: If
generatorKeyis specified, looks up the generator directly by key - Path and Type: If both
pathandtypeare specified, looks up the generator using path and type information
Usage Examples:
// Using generator key @ValueSource(generatorKey = "name") private String name; // Using path and type @ValueSource(path = "user.email", type = String.class) private String email;
- Type Parameters:
T- the expected return type of the generated value- Parameters:
field- the field annotated withValueSource- Returns:
- the generated value from the resolved generator
- Throws:
ValueSourceException- if the generator cannot be resolved from theValueSourceannotation (e.g., when neither generatorKey nor path+type combination is properly specified)
- Generator Key: If
-
handleRegexSource
-
initInstance
protected <T> T initInstance(Class<T> clazz) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException
-