Added description of Isset.
converted to 1.6 markup
|Deletions are marked like this.||Additions are marked like this.|
|Line 25:||Line 25:|
|`__isset` is necessary because Java primitives cannot be `null`. See discussion of [https://issues.apache.org/jira/browse/THRIFT-33 THRIFT-33].||`__isset` is necessary because Java primitives cannot be `null`. See discussion of [[https://issues.apache.org/jira/browse/THRIFT-33|THRIFT-33]].|
|Line 27:||Line 27:|
|See the [http://developers.facebook.com/thrift/thrift-20070401.pdf Thrift Whitepaper] for more information on the Isset class.||See the [[http://developers.facebook.com/thrift/thrift-20070401.pdf|Thrift Whitepaper]] for more information on the Isset class.|
If you add the "beans" option to the Java generator like this:
thrift --gen java:beans file.thrift
Thrift will generate JavaBean style classes.
Properties of Generated JavaBean Classes
All member fields are private.
- All member fields have mixed-cased getter and setter methods. For example, if the field is named "myValue", the methods will be "getMyValue" and "setMyValue".
- Getter methods for boolean fields begin with "is", for example, "isMyValue".
The Nested Isset Class
Each generated Bean class has public field named __isset, which is an instance of a nested class named Isset.
Each member field in the parent class has a corresponding public boolean field in the Isset class with the same name.
Setter methods update the corresponding __isset fields.
Each member field has an "unset" method, like "unsetMyValue", which erases the field's value and updates the corresponding __isset field.
Member fields whose corresponding __isset field is false will be omitted from the serialized output.
__isset is necessary because Java primitives cannot be null. See discussion of THRIFT-33.
See the Thrift Whitepaper for more information on the Isset class.