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

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


The following commit(s) were added to refs/heads/master by this push:
     new 82cb202  [scb-2086] fix problem about aggregated parameter
82cb202 is described below

commit 82cb202e051cd1eef21af9a88ec7e7fa0e7a0a3a
Author: wujimin <wuji...@huawei.com>
AuthorDate: Wed Sep 23 11:39:34 2020 +0800

    [scb-2086] fix problem about aggregated parameter
---
 .../common/utils/LambdaMetafactoryUtils.java       | 56 ++++++++++++++++++++++
 .../common/utils/bean/SetterWrapper.java           | 50 -------------------
 .../common/utils/TestLambdaMetafactoryUtils.java   | 56 ++++++++++++++++++++++
 .../config/inject/ConfigObjectFactory.java         | 10 ++--
 .../it/schema/objectparams/BeanParamRequest.java   | 56 ++++++++++------------
 .../objectparams/TestJAXRSObjectParamType.java     | 43 ++++++++++++-----
 .../generator/jaxrs/model/AggregatedParam.java     | 26 ++++++++++
 .../test/resources/schemas/aggregatedParam.yaml    | 14 ++++++
 .../consumer/ConsumerArgumentsMapperCreator.java   | 10 +---
 .../producer/ProducerArgumentsMapperCreator.java   | 10 +---
 10 files changed, 215 insertions(+), 116 deletions(-)

diff --git 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
index b392f6b..a63a9ab 100644
--- 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
+++ 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
@@ -47,6 +47,8 @@ import 
org.apache.servicecomb.foundation.common.utils.bean.Setter;
 import org.apache.servicecomb.foundation.common.utils.bean.ShortGetter;
 import org.apache.servicecomb.foundation.common.utils.bean.ShortSetter;
 
+import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
+
 public final class LambdaMetafactoryUtils {
   private static final Lookup LOOKUP = MethodHandles.lookup();
 
@@ -148,6 +150,19 @@ public final class LambdaMetafactoryUtils {
     return createLambda(getMethod, getterCls);
   }
 
+  @SuppressWarnings("unchecked")
+  public static Getter<Object, Object> createObjectGetter(Method getMethod) {
+    return createLambda(getMethod, Getter.class);
+  }
+
+  public static Getter<Object, Object> 
createObjectGetter(BeanPropertyDefinition propertyDefinition) {
+    if (propertyDefinition.hasGetter()) {
+      return createObjectGetter(propertyDefinition.getGetter().getAnnotated());
+    }
+
+    return createGetter(propertyDefinition.getField().getAnnotated());
+  }
+
   // slower than reflect directly
   @SuppressWarnings("unchecked")
   public static <C, F> Getter<C, F> createGetter(Field field) {
@@ -177,6 +192,47 @@ public final class LambdaMetafactoryUtils {
     return createLambda(setMethod, setterCls);
   }
 
+  // just for avoid java 9~11 bug: 
https://bugs.openjdk.java.net/browse/JDK-8174983
+  // otherwise can be replaced by: createLambda(setMethod, Setter.class)
+  @SuppressWarnings("unchecked")
+  public static Setter<Object, Object> createObjectSetter(Method setMethod) {
+    Object setter = createSetter(setMethod);
+    if (setter instanceof BoolSetter) {
+      return (Instance, value) -> ((BoolSetter) setter).set(Instance, 
(boolean) value);
+    }
+    if (setter instanceof ByteSetter) {
+      return (Instance, value) -> ((ByteSetter) setter).set(Instance, (byte) 
value);
+    }
+    if (setter instanceof CharSetter) {
+      return (Instance, value) -> ((CharSetter) setter).set(Instance, (char) 
value);
+    }
+    if (setter instanceof DoubleSetter) {
+      return (Instance, value) -> ((DoubleSetter) setter).set(Instance, 
(double) value);
+    }
+    if (setter instanceof FloatSetter) {
+      return (Instance, value) -> ((FloatSetter) setter).set(Instance, (float) 
value);
+    }
+    if (setter instanceof IntSetter) {
+      return (Instance, value) -> ((IntSetter) setter).set(Instance, (int) 
value);
+    }
+    if (setter instanceof LongSetter) {
+      return (Instance, value) -> ((LongSetter) setter).set(Instance, (long) 
value);
+    }
+    if (setter instanceof ShortSetter) {
+      return (Instance, value) -> ((ShortSetter) setter).set(Instance, (short) 
value);
+    }
+
+    return (Setter<Object, Object>) setter;
+  }
+
+  public static Setter<Object, Object> 
createObjectSetter(BeanPropertyDefinition propertyDefinition) {
+    if (propertyDefinition.hasSetter()) {
+      return createObjectSetter(propertyDefinition.getSetter().getAnnotated());
+    }
+
+    return createSetter(propertyDefinition.getField().getAnnotated());
+  }
+
   // slower than reflect directly
   public static <C, F> Setter<C, F> createSetter(Field field) {
     checkAccess(field);
diff --git 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/SetterWrapper.java
 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/SetterWrapper.java
deleted file mode 100644
index aa73d69..0000000
--- 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/SetterWrapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.foundation.common.utils.bean;
-
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class SetterWrapper {
-  private Object setter;
-
-  public SetterWrapper(Object setter) {
-    this.setter = setter;
-  }
-
-  public void set(Object instance, Object value) {
-    if (setter instanceof Setter) {
-      ((Setter) setter).set(instance, value);
-    } else if (setter instanceof BoolSetter) {
-      ((BoolSetter) setter).set(instance, (boolean) value);
-    } else if (setter instanceof ByteSetter) {
-      ((ByteSetter) setter).set(instance, (byte) value);
-    } else if (setter instanceof CharSetter) {
-      ((CharSetter) setter).set(instance, (char) value);
-    } else if (setter instanceof ShortSetter) {
-      ((ShortSetter) setter).set(instance, (short) value);
-    } else if (setter instanceof IntSetter) {
-      ((IntSetter) setter).set(instance, (int) value);
-    } else if (setter instanceof LongSetter) {
-      ((LongSetter) setter).set(instance, (long) value);
-    } else if (setter instanceof FloatSetter) {
-      ((FloatSetter) setter).set(instance, (float) value);
-    } else if (setter instanceof DoubleSetter) {
-      ((DoubleSetter) setter).set(instance, (double) value);
-    } else {
-      throw new IllegalStateException("unexpected setter " + 
setter.getClass().getName());
-    }
-  }
-}
diff --git 
a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
 
b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
index 0af9d27..014e956 100644
--- 
a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
+++ 
b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
@@ -16,6 +16,8 @@
  */
 package org.apache.servicecomb.foundation.common.utils;
 
+import static 
org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils.createObjectGetter;
+import static 
org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils.createObjectSetter;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.catchThrowable;
 
@@ -27,12 +29,18 @@ import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Supplier;
 
+import org.apache.servicecomb.foundation.common.utils.bean.Getter;
 import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
 import org.apache.servicecomb.foundation.common.utils.bean.IntSetter;
+import org.apache.servicecomb.foundation.common.utils.bean.Setter;
 import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Test;
 
+import com.fasterxml.jackson.databind.BeanDescription;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
+
 public class TestLambdaMetafactoryUtils {
   public static class Model {
     public int f1;
@@ -107,4 +115,52 @@ public class TestLambdaMetafactoryUtils {
         .hasMessage(
             "Can not access field, a public field or accessor is 
required.Declaring class is 
org.apache.servicecomb.foundation.common.utils.TestLambdaMetafactoryUtils$Model,
 field is f2");
   }
+
+  public static class Base<T> {
+    private T base;
+
+    public T getBase() {
+      return base;
+    }
+
+    public Base<T> setBase(T base) {
+      this.base = base;
+      return this;
+    }
+  }
+
+  public static class Child extends Base<Integer> {
+    private int child;
+
+    public int getChild() {
+      return child;
+    }
+
+    public Child setChild(int child) {
+      this.child = child;
+      return this;
+    }
+  }
+
+  @Test
+  public void should_support_primitive_type() {
+    Child child = new Child();
+
+    ObjectMapper mapper = JsonUtils.OBJ_MAPPER;
+    BeanDescription beanDescription = 
mapper.getSerializationConfig().introspect(mapper.constructType(Child.class));
+    List<BeanPropertyDefinition> properties = beanDescription.findProperties();
+    assertThat(properties).hasSize(2);
+
+    for (int idx = 0; idx < properties.size(); idx++) {
+      BeanPropertyDefinition property = properties.get(idx);
+
+      Setter<Object, Object> setter = 
createObjectSetter(property.getSetter().getAnnotated());
+      setter.set(child, idx);
+
+      Getter<Object, Object> getter = 
createObjectGetter(property.getGetter().getAnnotated());
+      Object value = getter.get(child);
+
+      assertThat(value).isEqualTo(idx);
+    }
+  }
 }
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/inject/ConfigObjectFactory.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/inject/ConfigObjectFactory.java
index 1c73d84..44fcb57 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/inject/ConfigObjectFactory.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/inject/ConfigObjectFactory.java
@@ -16,6 +16,8 @@
  */
 package org.apache.servicecomb.config.inject;
 
+import static 
org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils.createObjectSetter;
+
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
@@ -24,8 +26,7 @@ import java.util.Map;
 import org.apache.servicecomb.config.priority.PriorityProperty;
 import org.apache.servicecomb.config.priority.PriorityPropertyManager;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
-import org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils;
-import org.apache.servicecomb.foundation.common.utils.bean.SetterWrapper;
+import org.apache.servicecomb.foundation.common.utils.bean.Setter;
 
 import com.fasterxml.jackson.databind.BeanDescription;
 import com.fasterxml.jackson.databind.JavaType;
@@ -98,10 +99,7 @@ public class ConfigObjectFactory {
         continue;
       }
 
-      SetterWrapper setter = propertyDefinition.getSetter() == null ?
-          new 
SetterWrapper(LambdaMetafactoryUtils.createSetter(propertyDefinition.getField().getAnnotated()))
 :
-          new 
SetterWrapper(LambdaMetafactoryUtils.createSetter(propertyDefinition.getSetter().getAnnotated()));
-
+      Setter<Object, Object> setter = createObjectSetter(propertyDefinition);
       PriorityProperty<?> priorityProperty = 
createPriorityProperty(propertyDefinition.getField().getAnnotated());
       priorityProperty.setCallback((value, target) -> setter.set(target, 
value), instance);
       priorityProperties.add(priorityProperty);
diff --git 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/BeanParamRequest.java
 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/BeanParamRequest.java
index 00f0a38..915b63d 100644
--- 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/BeanParamRequest.java
+++ 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/BeanParamRequest.java
@@ -18,7 +18,6 @@
 package org.apache.servicecomb.it.schema.objectparams;
 
 import java.util.List;
-import java.util.Objects;
 
 import javax.ws.rs.HeaderParam;
 import javax.ws.rs.PathParam;
@@ -35,16 +34,24 @@ public class BeanParamRequest {
   @HeaderParam("header")
   private String header;
 
+  @QueryParam("query_array")
+  private String[] queryArray;
+
+  @QueryParam("query_list")
+  private List<String> queryList;
+
   @JsonIgnore
   private List<FlattenObjectRequest> ignored;
 
   public BeanParamRequest() {
   }
 
-  public BeanParamRequest(String path, int query, String header) {
+  public BeanParamRequest(String path, int query, String header, String[] 
queryArray, List<String> queryList) {
     this.path = path;
     this.query = query;
     this.header = header;
+    this.queryArray = queryArray;
+    this.queryList = queryList;
   }
 
   public String getPath() {
@@ -72,42 +79,29 @@ public class BeanParamRequest {
     this.header = header;
   }
 
-  public List<FlattenObjectRequest> getIgnored() {
-    return ignored;
+  public String[] getQueryArray() {
+    return queryArray;
   }
 
-  public void setIgnored(List<FlattenObjectRequest> ignored) {
-    this.ignored = ignored;
+  public BeanParamRequest setQueryArray(String[] queryArray) {
+    this.queryArray = queryArray;
+    return this;
   }
 
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("BeanParamRequest{");
-    sb.append("path='").append(path).append('\'');
-    sb.append(", query=").append(query);
-    sb.append(", header='").append(header).append('\'');
-    sb.append(", ignored=").append(ignored);
-    sb.append('}');
-    return sb.toString();
+  public List<String> getQueryList() {
+    return queryList;
   }
 
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    BeanParamRequest that = (BeanParamRequest) o;
-    return query == that.query &&
-        Objects.equals(path, that.path) &&
-        Objects.equals(header, that.header) &&
-        Objects.equals(ignored, that.ignored);
+  public BeanParamRequest setQueryList(List<String> queryList) {
+    this.queryList = queryList;
+    return this;
   }
 
-  @Override
-  public int hashCode() {
-    return Objects.hash(path, query, header, ignored);
+  public List<FlattenObjectRequest> getIgnored() {
+    return ignored;
+  }
+
+  public void setIgnored(List<FlattenObjectRequest> ignored) {
+    this.ignored = ignored;
   }
 }
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
index b8b1fe6..3c5a388 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
@@ -17,12 +17,16 @@
 
 package org.apache.servicecomb.it.testcase.objectparams;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import java.util.Arrays;
 import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.ws.rs.QueryParam;
+
 import org.apache.servicecomb.it.Consumers;
 import org.apache.servicecomb.it.schema.objectparams.BeanParamRequest;
 import org.apache.servicecomb.it.schema.objectparams.Color;
@@ -44,11 +48,17 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 
+import io.swagger.annotations.ApiOperation;
 import io.vertx.core.json.Json;
 
 public class TestJAXRSObjectParamType {
   interface JAXRSObjectParamTypeSchema extends ObjectParamTypeSchema {
-    BeanParamRequest testBeanParamRequest(String header, String path, int 
query);
+    BeanParamRequest testBeanParamRequest(String header, String path, int 
query,
+        @QueryParam("query_array") String[] queryArray, 
@QueryParam("query_list") List<String> queryList);
+
+    @ApiOperation(value = "", nickname = "testBeanParamRequest")
+    BeanParamRequest testBeanParamRequestAggr(BeanParamRequest request);
+
     FluentSetterBeanParamRequest testFluentSetterBeanParamRequest(String 
header, String path, int query);
   }
 
@@ -105,7 +115,8 @@ public class TestJAXRSObjectParamType {
   @Test
   public void testFluentSetterFlattenObjectParam_rpc() {
     FluentSetterFlattenObjectRequest fluentRequest = 
createFluentSetterFlattenObjectRequest();
-    FluentSetterFlattenObjectResponse fluentResponse = 
consumers.getIntf().testFluentSetterFlattenObjectParam(fluentRequest);
+    FluentSetterFlattenObjectResponse fluentResponse = consumers.getIntf()
+        .testFluentSetterFlattenObjectParam(fluentRequest);
     Assert.assertEquals(Json.encode(fluentRequest), 
Json.encode(fluentResponse));
 
     fluentRequest = new FluentSetterFlattenObjectRequest();
@@ -314,20 +325,28 @@ public class TestJAXRSObjectParamType {
 
   @Test
   public void testBeanParamRequest() {
-    BeanParamRequest response = 
consumers.getIntf().testBeanParamRequest("ss1", "ss2", 123);
-    BeanParamRequest expected = new BeanParamRequest("ss2", 123, "ss1");
-    Assert.assertEquals(expected, response);
+    String[] queryArray = {"a", "b"};
+    List<String> queryList = Arrays.asList("c", "d");
+    BeanParamRequest expected = new BeanParamRequest("ss2", 123, "ss1", 
queryArray, queryList);
+    String expectedJson = Json.encodePrettily(expected);
+
+    BeanParamRequest response = 
consumers.getIntf().testBeanParamRequest("ss1", "ss2", 123, queryArray, 
queryList);
+    assertThat(Json.encodePrettily(response)).isEqualTo(expectedJson);
+
+    response = consumers.getIntf().testBeanParamRequestAggr(expected);
+    assertThat(Json.encodePrettily(response)).isEqualTo(expectedJson);
 
     HttpHeaders headers = new HttpHeaders();
     headers.add("header", "ss1");
+    String url = 
"/beanParamRequest/ss2?query=123&query_array=a&query_array=b&query_list=c&query_list=d";
     ResponseEntity<BeanParamRequest> responseEntity = 
consumers.getSCBRestTemplate()
-        .exchange("/beanParamRequest/ss2?query=123", HttpMethod.GET, new 
HttpEntity<>(headers), BeanParamRequest.class);
-    Assert.assertEquals(expected, responseEntity.getBody());
+        .exchange(url, HttpMethod.GET, new HttpEntity<>(headers), 
BeanParamRequest.class);
+    
assertThat(Json.encodePrettily(responseEntity.getBody())).isEqualTo(expectedJson);
     Assert.assertEquals(200, responseEntity.getStatusCodeValue());
 
     responseEntity = consumers.getEdgeRestTemplate()
-        .exchange("/beanParamRequest/ss2?query=123", HttpMethod.GET, new 
HttpEntity<>(headers), BeanParamRequest.class);
-    Assert.assertEquals(expected, responseEntity.getBody());
+        .exchange(url, HttpMethod.GET, new HttpEntity<>(headers), 
BeanParamRequest.class);
+    
assertThat(Json.encodePrettily(responseEntity.getBody())).isEqualTo(expectedJson);
     Assert.assertEquals(200, responseEntity.getStatusCodeValue());
   }
 
@@ -340,12 +359,14 @@ public class TestJAXRSObjectParamType {
     HttpHeaders headers = new HttpHeaders();
     headers.add("header", "ss1");
     ResponseEntity<FluentSetterBeanParamRequest> responseEntity = 
consumers.getSCBRestTemplate()
-        .exchange("/fluentSetterBeanParamRequest/ss2?query=123", 
HttpMethod.GET, new HttpEntity<>(headers), FluentSetterBeanParamRequest.class);
+        .exchange("/fluentSetterBeanParamRequest/ss2?query=123", 
HttpMethod.GET, new HttpEntity<>(headers),
+            FluentSetterBeanParamRequest.class);
     Assert.assertEquals(expected, responseEntity.getBody());
     Assert.assertEquals(200, responseEntity.getStatusCodeValue());
 
     responseEntity = consumers.getEdgeRestTemplate()
-        .exchange("/fluentSetterBeanParamRequest/ss2?query=123", 
HttpMethod.GET, new HttpEntity<>(headers), FluentSetterBeanParamRequest.class);
+        .exchange("/fluentSetterBeanParamRequest/ss2?query=123", 
HttpMethod.GET, new HttpEntity<>(headers),
+            FluentSetterBeanParamRequest.class);
     Assert.assertEquals(expected, responseEntity.getBody());
     Assert.assertEquals(200, responseEntity.getStatusCodeValue());
   }
diff --git 
a/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/model/AggregatedParam.java
 
b/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/model/AggregatedParam.java
index 011c53c..16cc22e 100644
--- 
a/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/model/AggregatedParam.java
+++ 
b/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/model/AggregatedParam.java
@@ -16,6 +16,8 @@
  */
 package org.apache.servicecomb.swagger.generator.jaxrs.model;
 
+import java.util.List;
+
 import javax.ws.rs.CookieParam;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.FormParam;
@@ -38,6 +40,12 @@ public class AggregatedParam {
   @HeaderParam("header2")
   private String headerVal;
 
+  @QueryParam("query-array")
+  private String[] queryArray;
+
+  @QueryParam("query-list")
+  private List<String> queryList;
+
   public String getStrVal() {
     return strVal;
   }
@@ -80,4 +88,22 @@ public class AggregatedParam {
   public void setHeaderVal(String headerVal) {
     this.headerVal = headerVal;
   }
+
+  public String[] getQueryArray() {
+    return queryArray;
+  }
+
+  public AggregatedParam setQueryArray(String[] queryArray) {
+    this.queryArray = queryArray;
+    return this;
+  }
+
+  public List<String> getQueryList() {
+    return queryList;
+  }
+
+  public AggregatedParam setQueryList(List<String> queryList) {
+    this.queryList = queryList;
+    return this;
+  }
 }
diff --git 
a/swagger/swagger-generator/generator-jaxrs/src/test/resources/schemas/aggregatedParam.yaml
 
b/swagger/swagger-generator/generator-jaxrs/src/test/resources/schemas/aggregatedParam.yaml
index 9e40460..a074d0c 100644
--- 
a/swagger/swagger-generator/generator-jaxrs/src/test/resources/schemas/aggregatedParam.yaml
+++ 
b/swagger/swagger-generator/generator-jaxrs/src/test/resources/schemas/aggregatedParam.yaml
@@ -58,6 +58,20 @@ paths:
         in: "header"
         required: false
         type: "string"
+      - name: "query-array"
+        in: "query"
+        required: false
+        type: "array"
+        items:
+          type: "string"
+        collectionFormat: "multi"
+      - name: "query-list"
+        in: "query"
+        required: false
+        type: "array"
+        items:
+          type: "string"
+        collectionFormat: "multi"
       responses:
         "200":
           description: "response of 200"
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/consumer/ConsumerArgumentsMapperCreator.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/consumer/ConsumerArgumentsMapperCreator.java
index 42b74dc..d74965c 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/consumer/ConsumerArgumentsMapperCreator.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/consumer/ConsumerArgumentsMapperCreator.java
@@ -23,7 +23,6 @@ import java.lang.reflect.Method;
 import java.util.Map;
 
 import org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils;
-import org.apache.servicecomb.foundation.common.utils.bean.Getter;
 import org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation;
 import 
org.apache.servicecomb.swagger.invocation.arguments.AbstractArgumentsMapperCreator;
 import org.apache.servicecomb.swagger.invocation.arguments.ArgumentMapper;
@@ -117,14 +116,7 @@ public class ConsumerArgumentsMapperCreator extends 
AbstractArgumentsMapperCreat
         continue;
       }
 
-      Getter<Object, Object> getter;
-      if (propertyDefinition.hasGetter()) {
-        getter = 
LambdaMetafactoryUtils.createLambda(propertyDefinition.getGetter().getAnnotated(),
 Getter.class);
-      } else {
-        getter = 
LambdaMetafactoryUtils.createGetter(propertyDefinition.getField().getAnnotated());
-      }
-
-      mapper.addField(parameterName, getter);
+      mapper.addField(parameterName, 
LambdaMetafactoryUtils.createObjectGetter(propertyDefinition));
       processedSwaggerParamters.add(parameterName);
     }
     mappers.add(mapper);
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/producer/ProducerArgumentsMapperCreator.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/producer/ProducerArgumentsMapperCreator.java
index b27aea0..846d7de 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/producer/ProducerArgumentsMapperCreator.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/producer/ProducerArgumentsMapperCreator.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils;
-import org.apache.servicecomb.foundation.common.utils.bean.Setter;
 import org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation;
 import 
org.apache.servicecomb.swagger.invocation.arguments.AbstractArgumentsMapperCreator;
 import org.apache.servicecomb.swagger.invocation.arguments.ArgumentMapper;
@@ -113,15 +112,8 @@ public class ProducerArgumentsMapperCreator extends 
AbstractArgumentsMapperCreat
                 providerMethod.getDeclaringClass().getName(), 
providerMethod.getName(), parameterName));
       }
 
-      Setter<Object, Object> setter;
-      if (propertyDefinition.hasSetter()) {
-        setter = 
LambdaMetafactoryUtils.createLambda(propertyDefinition.getSetter().getAnnotated(),
 Setter.class);
-      } else {
-        setter = 
LambdaMetafactoryUtils.createSetter(propertyDefinition.getField().getAnnotated());
-      }
-
       swaggerParameterTypes.put(parameterName, 
propertyDefinition.getPrimaryType());
-      mapper.addField(parameterName, setter);
+      mapper.addField(parameterName, 
LambdaMetafactoryUtils.createObjectSetter(propertyDefinition));
       processedSwaggerParamters.add(parameterName);
     }
     mappers.add(mapper);

Reply via email to