Interface Generator

All Known Subinterfaces:
StubGenerator
All Known Implementing Classes:
ControllerGenerator, DtoGenerator, MapperGenerator, RelationshipMetaGenerator, RepositoryGenerator, SearchGenerator, ServiceGenerator

public interface Generator
Base contract for all writer components that turn a ModelDescriptor into one or more JavaFiles.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<com.squareup.javapoet.JavaFile>
    Builds the java files for the given model without writing them.
    static boolean
    Performs basic sanity checks on the descriptor before code generation.
    default int
    Determines the execution order within the generator group (basic or CRUD).
    default boolean
    Indicates whether this generator should only be applied to models that are marked as CrudCraft entities.
    default void
    Writes the generated files using the provided context.
  • Method Details

    • generate

      List<com.squareup.javapoet.JavaFile> generate(ModelDescriptor model, WriteContext ctx)
      Builds the java files for the given model without writing them.
      Parameters:
      model - the model descriptor to generate code for
      ctx - shared write context
      Returns:
      generated java files; never null
    • requiresCrudEntity

      default boolean requiresCrudEntity()
      Indicates whether this generator should only be applied to models that are marked as CrudCraft entities. Generators returning true are executed only when the model descriptor reports ModelDescriptor.isCrudCraftEntity() as true.
      Returns:
      true if the generator requires a CrudCraft entity
    • order

      default int order()
      Determines the execution order within the generator group (basic or CRUD). Lower values run first.
      Returns:
      the order value of this generator
    • write

      default void write(ModelDescriptor model, WriteContext ctx)
      Writes the generated files using the provided context.
    • isValidModelDescriptor

      static boolean isValidModelDescriptor(ModelDescriptor model, WriteContext ctx)
      Performs basic sanity checks on the descriptor before code generation. Logs a diagnostic message when invalid.
      Returns:
      true if the descriptor seems valid