thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Geyer <jensge...@hotmail.com>
Subject Re: Java Integer and Thrift i32, when null value is required by the business logic, how to solve this?
Date Sat, 04 Nov 2017 14:38:48 GMT
Welcome!

> I have a same problem as this one on Stackoverflow

And what is wrong with the answer given there?

Have fun,
JensG


-----Urspr√ľngliche Nachricht----- 
From: liubo@fcyun.com
Sent: Friday, November 3, 2017 5:14 PM
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





liubo@fcyun.com 


Mime
View raw message