public class CodeGenerator extends Object
This class generates Service definitions, clients for a provided ballerina service.
| Constructor and Description |
|---|
CodeGenerator() |
| Modifier and Type | Method and Description |
|---|---|
static String |
generateOutput(GeneratorConstants.GenType type,
ClientContextHolder context)
Generates code(client, server etc) for ballerina source provided in
definitionPath. |
static void |
writeFile(Path targetDirPath,
String fileName,
String fileContent)
Write given file content to a file at
targetDirPath. |
public static String generateOutput(GeneratorConstants.GenType type, ClientContextHolder context) throws CodeGeneratorException
definitionPath.
Method can be used for generating OAS 3.0.0, Swagger or Ballerina Client
type - Output type. Following types are supported
context - Context details for generating the clientCodeGeneratorException - when file operations failpublic static void writeFile(Path targetDirPath, String fileName, String fileContent) throws CodeGeneratorException
targetDirPath.targetDirPath - target dir path where the generated files to be createdfileName - file name to be createdfileContent - content to be written in to the fileCodeGeneratorException - when error occurred while generating the codeCopyright © 2019 WSO2. All rights reserved.