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: Added description of Isset. ------------------------------------------------------------------------------ == Properties of Generated JavaBean Classes == - 1. All member fields are `private` + 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. 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". - 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. + 1. 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. + + 1. Setter methods update the corresponding `__isset` fields. + 1. Each member field has an "unset" method, like "unsetMyValue", which erases the field's value and updates the corresponding `__isset` field. + 1. 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 [https://issues.apache.org/jira/browse/THRIFT-33 THRIFT-33]. + + See the [http://developers.facebook.com/thrift/thrift-20070401.pdf Thrift Whitepaper] for more information on the Isset class. +
