[
https://issues.apache.org/jira/browse/SCB-873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16602541#comment-16602541
]
ASF GitHub Bot commented on SCB-873:
------------------------------------
weichao666 commented on a change in pull request #884: [SCB-873] Make the
validation result display the parameter name instead of arg0, arg1
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/884#discussion_r214771580
##########
File path:
swagger/swagger-invocation/invocation-validator/src/main/java/org/apache/servicecomb/swagger/invocation/validator/ParanamerParameterNameProvider.java
##########
@@ -16,39 +16,55 @@
*/
package org.apache.servicecomb.swagger.invocation.validator;
+import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
import javax.validation.ParameterNameProvider;
import org.apache.servicecomb.swagger.generator.core.utils.ParamUtils;
public class ParanamerParameterNameProvider implements ParameterNameProvider {
+ private final Map<AccessibleObject, List<String>> methodCache =
makeMethodCache();
+
+ protected Map<AccessibleObject, List<String>> makeMethodCache() {
+ return Collections.synchronizedMap(new WeakHashMap<AccessibleObject,
List<String>>());
+ }
@Override
public List<String> getParameterNames(Constructor<?> constructor) {
- Parameter[] parameters = constructor.getParameters();
- List<String> parameterNames = new ArrayList<>(parameters.length);
+ List<String> parameterNames = methodCache.get(constructor);
Review comment:
what can i do to implement this ?
----------------------------------------------------------------
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:
[email protected]
> Make the validation result display the parameter name instead of arg0, arg1
> ---------------------------------------------------------------------------
>
> Key: SCB-873
> URL: https://issues.apache.org/jira/browse/SCB-873
> Project: Apache ServiceComb
> Issue Type: Improvement
> Components: Java-Chassis
> Affects Versions: java-chassis-1.0.0
> Reporter: WeiChao
> Assignee: WeiChao
> Priority: Major
> Fix For: java-chassis-1.1.0
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)