You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2009/02/07 02:08:59 UTC

svn commit: r741805 - in /incubator/thrift/trunk: compiler/cpp/src/generate/t_java_generator.cc lib/java/src/org/apache/thrift/TBase.java

Author: bryanduxbury
Date: Sat Feb  7 01:08:58 2009
New Revision: 741805

URL: http://svn.apache.org/viewvc?rev=741805&view=rev
Log:
THRIFT-303. java: Changes to __isset interface

This patch makes __isset always private and adds a method per field to set the __isset state when not using the bean-style generator.

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
    incubator/thrift/trunk/lib/java/src/org/apache/thrift/TBase.java

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc?rev=741805&r1=741804&r2=741805&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc Sat Feb  7 01:08:58 2009
@@ -628,8 +628,8 @@
   if (members.size() > 0) {
     out <<
       endl <<
-      indent() << "public final Isset __isset = new Isset();" << endl <<
-      indent() << "public static final class Isset implements java.io.Serializable {" << endl;
+      indent() << "private final Isset __isset = new Isset();" << endl <<
+      indent() << "private static final class Isset implements java.io.Serializable {" << endl;
     indent_up();
       for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
         indent(out) <<
@@ -1441,6 +1441,14 @@
     indent(out) << "return this.__isset." << field_name << ";" << endl;
     indent_down();
     indent(out) << "}" << endl << endl;
+    
+    if(!bean_style_) {
+      indent(out) << "public void set" << cap_name << get_cap_name("isSet") << "(boolean value) {" << endl;
+      indent_up();
+      indent(out) << "this.__isset." << field_name << " = value;" << endl;
+      indent_down();
+      indent(out) << "}"; 
+    }
   }
 }
 

Modified: incubator/thrift/trunk/lib/java/src/org/apache/thrift/TBase.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/src/org/apache/thrift/TBase.java?rev=741805&r1=741804&r2=741805&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/src/org/apache/thrift/TBase.java (original)
+++ incubator/thrift/trunk/lib/java/src/org/apache/thrift/TBase.java Sat Feb  7 01:08:58 2009
@@ -28,14 +28,14 @@
    * @param oprot Output protocol
    */
   public void write(TProtocol oprot) throws TException;
-  
+
   /**
    * Check if a field is currently set or unset.
    *
    * @param fieldId The field's id tag as found in the IDL.
    */
   public boolean isSet(int fieldId);
-  
+
   /**
    * Get a field's value by id. Primitive types will be wrapped in the 
    * appropriate "boxed" types.
@@ -43,7 +43,7 @@
    * @param fieldId The field's id tag as found in the IDL.
    */
   public Object getFieldValue(int fieldId);
-  
+
   /**
    * Set a field's value by id. Primitive types must be "boxed" in the 
    * appropriate object wrapper type.