Java Thrift objects implement common base interface

Reviewed By: dreiss

Test Plan: Generate java code and run against new library.

Revert: OK

DiffCamp Revision: 900


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665296 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index eef82af..ea27854 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -362,7 +362,7 @@
   if (is_exception) {
     out << "extends Exception ";
   }
-  out << "implements java.io.Serializable ";
+  out << "implements TBase, java.io.Serializable ";
   
   scope_up(out);
 
diff --git a/lib/java/src/TBase.java b/lib/java/src/TBase.java
new file mode 100644
index 0000000..6a30ae0
--- /dev/null
+++ b/lib/java/src/TBase.java
@@ -0,0 +1,31 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+package com.facebook.thrift;
+
+import com.facebook.thrift.protocol.TProtocol;
+
+/**
+ * Generic base interface for generated Thrift objects.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+public interface TBase  {
+
+  /**
+   * Reads the TObject from the given input protocol.
+   *
+   * @param iprot Input protocol
+   */
+  public void read(TProtocol iprot) throws TException;
+
+  /**
+   * Writes the objects out to the protocol
+   *
+   * @param oprot Output protocol
+   */
+  public void write(TProtocol oprot) throws TException;
+}