You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/06/21 07:09:54 UTC

[servicecomb-toolkit] 38/49: add pojo template

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 9dc1077536c6627178ba918701c2ee807d2e7b5d
Author: kakulisen <18...@163.com>
AuthorDate: Mon Jun 3 15:00:01 2019 +0800

    add pojo template
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../ServiceComb/consumer/pojo/apiConsumer.mustache | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
new file mode 100755
index 0000000..0465fc4
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
@@ -0,0 +1,24 @@
+package {{apiPackage}};
+
+import java.util.List;
+{{#imports}}import {{import}};
+{{/imports}}
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
+
+{{#operations}}
+@Component
+public class {{classname}}Consumer implements {{classname}}{
+
+  @RpcReference(microserviceName = "{{microserviceName}}", schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+  private {{classname}} api;
+
+{{#operation}}
+  @Override
+  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>consumer/queryParamsConsumer}}{{>consumer/pathParamsConsumer}}{{>consumer/headerParamsConsumer}}{{>consumer/bodyParamsConsumer}}{{>consumer/formParamsConsumer}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
+
+    return api.{{operationId}}({{#allParams}}{{#isQueryParam}}{{paramName}}{{/isQueryParam}}{{#isPathParam}}{{paramName}}{{/isPathParam}}{{#isHeaderParam}}{{paramName}}{{/isHeaderParam}}{{#isBodyParam}}{{paramName}}{{/isBodyParam}}{{#isFormParam}}{{paramName}}{{/isFormParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+  }
+{{/operation}}
+}
+{{/operations}}
\ No newline at end of file