Package mocka.orm.generator
Class AbstractORMCreator
java.lang.Object
mocka.orm.generator.AbstractORMCreator
- All Implemented Interfaces:
Creator
- Direct Known Subclasses:
HibernateCreator,MyBatisCreator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandleRegexSource(Field field) <T> ThandleValueSource(Field field) Handles field value generation for fields annotated withValueSource.<T> TinitInstance(Class<T> clazz) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mocka.core.generator.Creator
createFromFileSource
-
Constructor Details
-
AbstractORMCreator
public AbstractORMCreator()
-
-
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;
- Specified by:
handleValueSourcein interfaceCreator- 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
- Specified by:
handleRegexSourcein interfaceCreator
-
initInstance
- Specified by:
initInstancein interfaceCreator
-