Class ControllerGenerator

java.lang.Object
nl.datasteel.crudcraft.codegen.writer.stubs.ControllerGenerator
All Implemented Interfaces:
Generator, StubGenerator

public class ControllerGenerator extends Object implements StubGenerator
Generates REST controllers directly from templates without relying on an abstract base class.
  • Constructor Details

    • ControllerGenerator

      public ControllerGenerator()
  • Method Details

    • build

      public com.squareup.javapoet.JavaFile build(ModelDescriptor modelDescriptor, WriteContext ctx)
      Description copied from interface: StubGenerator
      Build the JavaFile representing the stub.
      Specified by:
      build in interface StubGenerator
    • write

      public void write(ModelDescriptor modelDescriptor, WriteContext ctx)
      Description copied from interface: StubGenerator
      Writes the generated stub files to the context. Editable stubs are written just like non-editable ones; a subsequent tooling step will decide whether to keep or copy them into the user's source tree.
      Specified by:
      write in interface Generator
      Specified by:
      write in interface StubGenerator
      Parameters:
      modelDescriptor - the model descriptor to generate code for
      ctx - shared write context
    • requiresCrudEntity

      public boolean requiresCrudEntity()
      Description copied from interface: Generator
      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.
      Specified by:
      requiresCrudEntity in interface Generator
      Returns:
      true if the generator requires a CrudCraft entity
    • order

      public int order()
      Description copied from interface: Generator
      Determines the execution order within the generator group (basic or CRUD). Lower values run first.
      Specified by:
      order in interface Generator
      Returns:
      the order value of this generator