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 JavaFile
s.-
Method Summary
Modifier and TypeMethodDescriptionList
<com.squareup.javapoet.JavaFile> generate
(ModelDescriptor model, WriteContext ctx) Builds the java files for the given model without writing them.static boolean
isValidModelDescriptor
(ModelDescriptor model, WriteContext ctx) Performs basic sanity checks on the descriptor before code generation.default int
order()
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
write
(ModelDescriptor model, WriteContext ctx) Writes the generated files using the provided context.
-
Method Details
-
generate
Builds the java files for the given model without writing them.- Parameters:
model
- the model descriptor to generate code forctx
- 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 returningtrue
are executed only when the model descriptor reportsModelDescriptor.isCrudCraftEntity()
astrue
.- 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
Writes the generated files using the provided context. -
isValidModelDescriptor
Performs basic sanity checks on the descriptor before code generation. Logs a diagnostic message when invalid.- Returns:
true
if the descriptor seems valid
-