You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/04/26 13:55:47 UTC

[GitHub] [dubbo-go-hessian2] zhushengjun-it opened a new issue, #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

zhushengjun-it opened a new issue, #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313

   <!-- Please only use this template for submitting enhancement requests -->
   
   **What would you like to be added**:
   Java-server使用int类型枚举作为类属性,golang client希望增加个demo
   **Why is this needed**:
   目前公司其他组java后端有很多这样的类型作为类的属性,目前我这边接入使用string枚举的demo,在实现的方法中做了转换,java-server解析会有点问题,希望可以出一个int枚举的demo,可以供参考一下。


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] zhushengjun-it commented on issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
zhushengjun-it commented on issue #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313#issuecomment-1131531313

   > > 我在golang-client 定义结构体中的属性为int时:调用会报错:java exception:Fail to decode request due to: RpcInvocation
   > > 如果注释掉这个int的属性参数,那么请求就成功了。
   > > java-server 中这个属性的定义 : public enum ActionType { UNDEFINED(0), ... } @expose private ActionType actionType;
   > 
   > java这样的枚举定义,golang中可能要用string来接收
   
   我试了一下 string貌似也不行。我如果注释掉这个字段,java那边收到的这个参数是null。


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] zhushengjun-it commented on issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
zhushengjun-it commented on issue #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313#issuecomment-1131482722

   > 
   
   我在golang-client 定义结构图中的属性为int时:调用会报错:java exception:Fail to decode request due to: RpcInvocation
   
   如果注释掉这个int的属性参数,那么请求就成功了。
   
   java-server 中这个属性的定义 :  
   public enum ActionType {
         UNDEFINED(0),
         ...
   }
    @Expose
       private ActionType actionType;


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo commented on issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313#issuecomment-1110426021

   @zhushengjun-it  java int就直接在golang中用int接收就好,具体枚举值程序判断就好。


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] zhushengjun-it closed issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
zhushengjun-it closed issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo
URL: https://github.com/apache/dubbo-go-hessian2/issues/313


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo commented on issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313#issuecomment-1131520531

   > 我在golang-client 定义结构体中的属性为int时:调用会报错:java exception:Fail to decode request due to: RpcInvocation
   > 
   > 如果注释掉这个int的属性参数,那么请求就成功了。
   > 
   > java-server 中这个属性的定义 : public enum ActionType { UNDEFINED(0), ... } @expose private ActionType actionType;
   
   java这样的枚举定义,golang中可能要用string来接收


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] zhushengjun-it commented on issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
zhushengjun-it commented on issue #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313#issuecomment-1131484787

   我在golang-client 定义结构体中的属性为int时:调用会报错:java exception:Fail to decode request due to: RpcInvocation
   
   如果注释掉这个int的属性参数,那么请求就成功了。
   
   java-server 中这个属性的定义 :
   public enum ActionType {
   UNDEFINED(0),
   ...
   }
   @expose
   private ActionType actionType;


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] zhushengjun-it commented on issue #313: Java-server使用int类型枚举作为类属性,golang client希望增加个demo

Posted by GitBox <gi...@apache.org>.
zhushengjun-it commented on issue #313:
URL: https://github.com/apache/dubbo-go-hessian2/issues/313#issuecomment-1131760647

   已解决。
   golang定义:
   
   type ActionType struct {
   	Name string
   }
   
   func (a ActionType) JavaClassName() string {
   	return "actionType的父类名"
   }
   func (a ActionType) JavaParamName() string {
   	return "actionType的类名"
   }
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org