Class Generator

java.lang.Object
ch.colabproject.colab.generator.plugin.Generator

public class Generator extends Object
Author:
maxence
  • Constructor Details

    • Generator

      public Generator(String[] restPackages, String packageName, String clientName)
      Initialize the client generator.
      Parameters:
      restPackages - packages to analyze
      packageName - package in which generate the client
      clientName - client class name
    • Generator

      public Generator(String[] pkgs)
      Initialize the client generator.
      Parameters:
      pkgs - packages to analyze
  • Method Details

    • getJsonBMapper

      public jakarta.json.bind.Jsonb getJsonBMapper()
      get JSON-B to use.
      Returns:
      jsbonb mapper
    • processPackages

      public void processPackages()
      Process all classes annotated with Path. Generate a RestEndpoint instance for each class and store them in restEndpoints
    • generateJavaClient

      public void generateJavaClient(String targetDir, boolean dryRun) throws org.apache.maven.plugin.MojoFailureException
      One all classes have been processed with processPackages(), this method will create subdirectories that match the packageName.Then the client will be generated in the clientName.java file.
      Parameters:
      targetDir - target directory
      dryRun - if true, do not generate files but print output to console
      Throws:
      org.apache.maven.plugin.MojoFailureException - if generation fails
    • getRestEndpoints

      public Set<RestEndpoint> getRestEndpoints()
      Get rest service description
      Returns:
      all rest resource
    • generateTypescriptClient

      public void generateTypescriptClient(String targetDir, boolean dryRun) throws org.apache.maven.plugin.MojoFailureException
      Generate typescript client in targetDir
      Parameters:
      targetDir - generate TS module in this directory
      dryRun - if true, do not generate any file but print output to console
      Throws:
      org.apache.maven.plugin.MojoFailureException - if generation fails