Class EntityModelGenerator
java.lang.Object
dev.morphia.critter.parser.generator.BaseGenerator
dev.morphia.critter.parser.generator.EntityModelGenerator
Generates a ClassFile-based
CritterEntityModel implementation for a Morphia entity class.-
Field Summary
Fields inherited from class dev.morphia.critter.parser.generator.BaseGenerator
baseName, critterClassLoader, entity, generatedType -
Constructor Summary
ConstructorsConstructorDescriptionEntityModelGenerator(Mapper mapper, Class<?> type, CritterClassLoader critterClassLoader, List<PropertyModelGenerator> properties) Creates a new entity model generator where the entity class is also the annotation source.EntityModelGenerator(Mapper mapper, Class<?> type, Class<?> standinType, CritterClassLoader critterClassLoader, List<PropertyModelGenerator> properties) Creates a new entity model generator for the given entity, reading entity-level annotations fromstandinType(which differs fromtypeonly for@ExternalEntity). -
Method Summary
Modifier and TypeMethodDescriptionemit()Emits the generated entity model class and returns this generator.Returns the fully-qualified name of the generated entity model class.
-
Constructor Details
-
EntityModelGenerator
public EntityModelGenerator(Mapper mapper, Class<?> type, Class<?> standinType, CritterClassLoader critterClassLoader, List<PropertyModelGenerator> properties) Creates a new entity model generator for the given entity, reading entity-level annotations fromstandinType(which differs fromtypeonly for@ExternalEntity).- Parameters:
mapper- the Morphia mappertype- the target class for which code is generated (instances of this type are persisted)standinType- the class carrying the entity-level Morphia annotations; equalstypefor normal entitiescritterClassLoader- the class loader that will receive the generated bytecodeproperties- the property model generators for each of the entity's properties- Throws:
IllegalStateException- if neither@Entitynor@ExternalEntityis present onstandinType
-
EntityModelGenerator
public EntityModelGenerator(Mapper mapper, Class<?> type, CritterClassLoader critterClassLoader, List<PropertyModelGenerator> properties) Creates a new entity model generator where the entity class is also the annotation source.
-
-
Method Details
-
getGeneratedType
Returns the fully-qualified name of the generated entity model class. -
emit
Emits the generated entity model class and returns this generator.
-