How to get null value instead of default value 0 of field column from  thrift 
i32 field?
or How to make some fileds don't  transfer between thrift client and server?




[email protected]
 
From: [email protected]
Date: 2017-11-04 00:14
To: user
Subject: Java Integer and Thrift i32, when null value is required by the 
business logic, how to solve this?
 
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
 
 
 
 
 
[email protected]

Reply via email to