Class CodeGenerator

java.lang.Object
io.asyncapi.generator.codegen.CodeGenerator

public class CodeGenerator extends Object
Main orchestrator: reads a parsed AsyncAPI document and writes Java source files for models, consumers, producers, topic constants, and optional Kafka configuration.
  • Constructor Details

    • CodeGenerator

      public CodeGenerator(Map<String,Object> doc, String basePackage, File outputDir, boolean generateKafkaConfig, boolean useLombok)
      Parameters:
      doc - the root AsyncAPI document parsed as a plain Map
      basePackage - Java package prefix for all generated types
      outputDir - root directory where source files are written
      generateKafkaConfig - whether to emit an AsyncApiKafkaConfig bean
      useLombok - whether to annotate models with Lombok annotations
  • Method Details

    • generate

      public int generate() throws IOException
      Runs all generation phases.
      Returns:
      total number of Java source files written
      Throws:
      IOException - if a file cannot be written