You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by Apache Wiki <wi...@apache.org> on 2008/07/25 17:51:10 UTC

[Thrift Wiki] Update of "ThriftJavaBeans" by StuartSierra

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Thrift Wiki" for change notification.

The following page has been changed by StuartSierra:
http://wiki.apache.org/thrift/ThriftJavaBeans

The comment on the change is:
Created page to describe differences in JavaBean-generated code.

New page:
If you add the "beans" option to the Java generator like this:

{{{
thrift --gen java:beans  file.thrift
}}}

Thrift will generate JavaBean-style classes.  

For more information on JavaBeans, see WikiPedia:JavaBeans

== Properties of Generated JavaBean Classes ==

 1. All member fields are `private`
 1. All member field have mixed-cased getter and setter methods.  For example, if the field is named "myValue", the methods will be "getMyValue" and "setMyValue".
 1. If a field is declared `optional`, it will have an "unset" method, like "unsetMyValue", which erases the field's value and ensures it will not be present in the serialized output.