public interface Emitter
A dialect of generated code: REST Docs descriptors, WireMock stubs, and the like.

Implementations need a public no-argument constructor, as ServiceLoader requires, and must not keep state between calls to emit(EmitterContext).

  • Method Summary

    Modifier and Type
    Method
    Description
    The libraries the generated code needs, which the plugin adds to the source sets it generates into when the project does not declare them itself.
    void
    Writes this emitter's classes for one contract.
    id()
    The emitter's identifier: lower case, such as restdocs.
    The classified constructs this emitter represents in full.
  • Method Details

    • id

      String id()
      The emitter's identifier: lower case, such as restdocs. It names the package its companion classes go in, under the base package.
      Returns:
      the identifier
    • dependencies

      List<ManagedDependency> dependencies()
      The libraries the generated code needs, which the plugin adds to the source sets it generates into when the project does not declare them itself.
      Returns:
      the dependencies; empty when the generated code needs none
    • represents

      Set<Construct> represents()
      The classified constructs this emitter represents in full. For any other construct in a class, the emitter writes the affected method with EmitterContext.degraded(String, String, com.arc_e_tect.gradle.apionly.transcriberj.model.Finding).
      Returns:
      the constructs represented
    • emit

      void emit(EmitterContext context)
      Writes this emitter's classes for one contract.
      Parameters:
      context - the contract, the settings, the class names and where to write