thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "liubo@fcyun.com" <li...@fcyun.com>
Subject Java Integer and Thrift i32, when null value is required by the business logic, how to solve this?
Date Fri, 03 Nov 2017 16:14:45 GMT

Hi all,
I have a same problem as this one on Stackoverflow https://stackoverflow.com/questions/21576060/apache-thrift-java-object-data-types.



i'm stuck with Thrift about data types.
Now when i map and Integer value to a thrift generated bean, i'm using i32 type in the idl
definition.
class MyBean {
  Integer i = null;
}
struct TMyBean {
  1: i32 i;
}
The problem is that in TMyBean generated bean, the i var is an int primitive type, than it's
putting 0 as the default value, and for me 0 it's a valid value.
I've tried to put the optional keyword in the idl file, but things are not changing, it's
always int.
How i've to handle this situation? i need i to accept a null value in TMyBean i var.
Thanks





liubo@fcyun.com
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message