Class GenerateAsyncApiTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
io.asyncapi.generator.GenerateAsyncApiTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@CacheableTask public abstract class GenerateAsyncApiTask extends org.gradle.api.DefaultTask
Gradle task that parses an AsyncAPI 3.x specification and generates Spring Kafka consumer and producer Java source files.

This task is incremental: it is UP-TO-DATE when neither the spec file nor any input properties have changed since the last build.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Executes code generation: parses the AsyncAPI spec and writes Java sources.
    abstract org.gradle.api.provider.Property<String>
    Base Java package for all generated types.
    abstract org.gradle.api.provider.Property<Boolean>
    Whether to generate a AsyncApiKafkaConfig Spring configuration bean.
    abstract org.gradle.api.file.RegularFileProperty
    The AsyncAPI spec file to parse (YAML or JSON).
    abstract org.gradle.api.file.DirectoryProperty
    Directory where generated Java source files will be written.
    abstract org.gradle.api.provider.Property<Boolean>
    Whether to annotate generated model classes with Lombok annotations.

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • GenerateAsyncApiTask

      public GenerateAsyncApiTask()
  • Method Details

    • getInputFile

      @InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getInputFile()
      The AsyncAPI spec file to parse (YAML or JSON).
      Returns:
      file property for the spec
    • getOutputDir

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()
      Directory where generated Java source files will be written. Defaults to build/generated/sources/asyncapi/main/java.
      Returns:
      directory property for generated sources
    • getBasePackage

      @Input public abstract org.gradle.api.provider.Property<String> getBasePackage()
      Base Java package for all generated types.
      Returns:
      string property for the base package
    • getGenerateKafkaConfig

      @Input public abstract org.gradle.api.provider.Property<Boolean> getGenerateKafkaConfig()
      Whether to generate a AsyncApiKafkaConfig Spring configuration bean.
      Returns:
      boolean property
    • getUseLombok

      @Input public abstract org.gradle.api.provider.Property<Boolean> getUseLombok()
      Whether to annotate generated model classes with Lombok annotations.
      Returns:
      boolean property
    • generate

      public void generate() throws IOException
      Executes code generation: parses the AsyncAPI spec and writes Java sources.
      Throws:
      IOException - if the spec cannot be read or sources cannot be written