thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BCG <>
Subject Re: Does Thrift interoperate with Java beans?
Date Tue, 06 Oct 2015 02:10:38 GMT
Swift is good for this; also I have a fork that allows for annotating 
interfaces for structs and unions instead of just classes 
( and I've made a pull request to the 
Swift team ( but I'm not 
holding my breath because it seems that if you don't work at Facebook 
they can't hear you that well.

I've found that using interfaces for structs provides the flexibility 
needed for the original question.  You can do the same with classes to 
but with interfaces you can use all your favorite Gang of Four stuff or 
whatever, and in case your existing data model doesn't match up with the 
Thrift model very well, using Java interfaces with builders make it 
easier to meet in the middle.

In any case, I agree that Swift is a good option for the original 
question in this thread.  URL for Swift proper is here:, or you can find my fork at the URL 
referenced above

On 10/05/2015 08:41 PM, Stuart Reynolds wrote:
> Kinda. Sorta.
> Vanilla Thrift generates Java data classes that looks pretty beany to
> me (they have the standard getters and setters). However, I've always
> felt that there's a big downside to giving up control of your server
> code - not least, you can't add any additional advanced bean
> annotations (or any other kind of annotation) to you classes, nor can
> you directly serialize third party classes not produced by Thrift.
> This often leads to you wrap the serialization, which kinda defeats
> many of the benefits having it automated and had me banging my head on
> the table in dispair.
> I've since been using Facebook's Swift project. This lets you
> *generate* your thrift IDL from your *existing* server interfaces and
> bean classes, but also maintain thirft's extremely efficient
> serialization (via runtime class generation). The project has a few
> design choices I've not a fan of (export classes but not interfaces,
> has a HUGE set of dependencies, most unrelated to serialization), but
> I've made a fork for scala to allow me to work around the bigger
> issues. For me, its been hugely efficient at letting my export any old
> interface or data structure with no data marshaling steps.
> - Stuart
> On Mon, Oct 5, 2015 at 4:37 PM, David Bennett <> wrote:
>> I have some lumps of code in different languages that I'd like to get to talk to
each other. The server is OK, but the client code makes heavy use of Java beans.
>> My question, to those who knows a lot more about Java than I do, is whether there
is some clever way to get Thrift and Java beans to play together, or whether this is an invitation
to getter/setter hell?
>> Regards
>> David M Bennett FACS
>> Andl - A New Database Language -

View raw message