use of org.ballerinalang.code.generator.model.ClientContextHolder in project ballerina by ballerina-lang.
the class ClientGeneratorPlugin method process.
@Override
public void process(ServiceNode serviceNode, List<AnnotationAttachmentNode> annotations) {
CodeGenerator codegen = new CodeGenerator();
PrintStream err = System.err;
AnnotationAttachmentNode config = GeneratorUtils.getAnnotationFromList("ClientConfig", GeneratorConstants.SWAGGER_PKG_ALIAS, annotations);
// Generate client only if requested by providing the client config annotation
if (isClientGenerationEnabled(config)) {
try {
ClientContextHolder context = ClientContextHolder.buildContext(serviceNode, endpoints);
codegen.writeGeneratedSource(GeneratorConstants.GenType.CLIENT, context, getOutputFilePath(serviceNode));
} catch (CodeGeneratorException e) {
err.println("Client code was not generated: " + e.getMessage());
}
}
}
Aggregations