Class Generator
- java.lang.Object
-
- ch.colabproject.colab.generator.plugin.Generator
-
public class Generator extends Object
- Author:
- maxence
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgenerateJavaClient(String targetDir, boolean dryRun)One all classes have been processed withprocessPackages(), this method will create subdirectories that match thepackageName.Then the client will be generated in theclientName.java file.voidgenerateTypescriptClient(String targetDir, boolean dryRun)Generate typescript client in targetDirjavax.json.bind.JsonbgetJsonBMapper()get JSON-B to use.Set<RestEndpoint>getRestEndpoints()Get rest service descriptionvoidprocessPackages()Process all classes annotated withPath.
-
-
-
Constructor Detail
-
Generator
public Generator(String[] restPackages, String packageName, String clientName)
Initialize the client generator.- Parameters:
restPackages- packages to analyzepackageName- package in which generate the clientclientName- client class name
-
Generator
public Generator(String[] pkgs)
Initialize the client generator.- Parameters:
pkgs- packages to analyze
-
-
Method Detail
-
getJsonBMapper
public javax.json.bind.Jsonb getJsonBMapper()
get JSON-B to use.- Returns:
- jsbonb mapper
-
processPackages
public void processPackages()
Process all classes annotated withPath. Generate aRestEndpointinstance for each class and store them inrestEndpoints
-
generateJavaClient
public void generateJavaClient(String targetDir, boolean dryRun) throws org.apache.maven.plugin.MojoFailureException
One all classes have been processed withprocessPackages(), this method will create subdirectories that match thepackageName.Then the client will be generated in theclientName.java file.- Parameters:
targetDir- target directorydryRun- 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 directorydryRun- if true, do not generate any file but print output to console- Throws:
org.apache.maven.plugin.MojoFailureException- if generation fails
-
-