You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/05/31 08:05:42 UTC

[GitHub] [servicecomb-java-chassis] xiaojunl edited a comment on issue #1213: rpc提供方方法重名,消费方调用时,会报方法名找不到的错误

xiaojunl edited a comment on issue #1213: rpc提供方方法重名,消费方调用时,会报方法名找不到的错误
URL: https://github.com/apache/servicecomb-java-chassis/issues/1213#issuecomment-497593364
 
 
   provider:
   `
   public interface MethodOverloadService {
    
       String singleParamMethod(String name);
    
       String singleParamMethod(List<String> names);
    
       String multipleParamMethod(String type, String name);
    
       String multipleParamMethod(String type, List<String> names);
    
   }
   
   @RpcSchema(schemaId="methodOverloadService")
   public class MethodOverloadServiceImpl implements MethodOverloadService {
    
       @Override
       public String singleParamMethod(String name) {
           return "hi " + name;
       }
    
       @Override
       @ApiOperation(value = "", nickname = "singleParamMethods")
       public String singleParamMethod(List<String> names) {
           return "hi " + names.stream().collect(Collectors.joining(","));
       }
    
       @Override
       public String multipleParamMethod(String type, String name) {
           return "hi " + name + ", with type " + type;
       }
    
       @Override
       @ApiOperation(value = "", nickname = "multipleParamMethods")
       public String multipleParamMethod(String type, List<String> names) {
           return "hi " + names.stream().collect(Collectors.joining(",")) + ", with type " + type;
       }
   }
   `
   
   consumer:
   `
   @RestSchema(schemaId="methodOverloadController")
   @RequestMapping("/overload")
   public class MethodOverloadController {
       @RpcReference(microserviceName = "service-demo-services", schemaId = "methodOverloadService")
       private MethodOverloadService methodOverloadService;
    
       @GetMapping("/singleParamMethod")
       public String singleParamMethod(String name) {
         return methodOverloadService.singleParamMethod(name);
       }
    
       @GetMapping("/singleParamMethods")
       @ApiOperation(value = "", nickname = "singleParamMethods")
       public String singleParamMethod(List<String> names) {
         return methodOverloadService.singleParamMethods(names);
       }
   }
   `

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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