Class EntityModelGenerator

java.lang.Object
dev.morphia.critter.parser.generator.BaseGenerator
dev.morphia.critter.parser.generator.EntityModelGenerator

public class EntityModelGenerator extends BaseGenerator
Generates a ClassFile-based CritterEntityModel implementation for a Morphia entity 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 from standinType (which differs from type only for @ExternalEntity).
      Parameters:
      mapper - the Morphia mapper
      type - the target class for which code is generated (instances of this type are persisted)
      standinType - the class carrying the entity-level Morphia annotations; equals type for normal entities
      critterClassLoader - the class loader that will receive the generated bytecode
      properties - the property model generators for each of the entity's properties
      Throws:
      IllegalStateException - if neither @Entity nor @ExternalEntity is present on standinType
    • 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

      public String getGeneratedType()
      Returns the fully-qualified name of the generated entity model class.
    • emit

      public EntityModelGenerator emit()
      Emits the generated entity model class and returns this generator.