You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/01/10 06:24:47 UTC

[GitHub] wujimin commented on a change in pull request #497: [JAV-579]support strArray

wujimin commented on a change in pull request #497: [JAV-579]support strArray
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/497#discussion_r160597845
 
 

 ##########
 File path: common/common-rest/src/main/java/io/servicecomb/common/rest/codec/param/QueryProcessorCreator.java
 ##########
 @@ -26,10 +29,36 @@
 
 import io.servicecomb.common.rest.codec.RestClientRequest;
 import io.swagger.models.parameters.Parameter;
+import io.swagger.models.parameters.QueryParameter;
 
 public class QueryProcessorCreator implements ParamValueProcessorCreator {
+
   public static final String PARAMTYPE = "query";
 
+  public QueryProcessorCreator() {
+    ParamValueProcessorCreatorManager.INSTANCE.register(PARAMTYPE, this);
+  }
+
+  @Override
+  public ParamValueProcessor create(Parameter parameter, Type genericParamType) {
+    JavaType targetType = TypeFactory.defaultInstance().constructType(genericParamType);
+
+    String collectionFormat = ((QueryParameter) parameter).getCollectionFormat();
+
+    if (collectionFormat == null) {
+      return new QueryProcessor(parameter.getName(), targetType);
+    }
+    if (collectionFormat.equals("csv")) {
+      return new CsvQueryProcessor(parameter.getName(), targetType);
+    }
+    if (collectionFormat.equals("multi")) {
+      return new MultiQueryProcessor(parameter.getName(), targetType);
 
 Review comment:
   what's the relationship between MultiQueryProcessor and QueryProcessor
   their code are the same.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services