Add toString to Java code

* toString is mainly for debugging purposes.
* For structs and interfaces, add Object.toString.
* For enums, add MyEnum.toString(int) and MyEnum.dumpBitfield(int).

Use them as follows:
* For enums, use the static method E.toString(int).
* For bitfields, use the static method E.dumpBitfield(int).
* For all arrays, use java.utils.Arrays.deepToString(o)
* For everything else, use one of the following:
    * o.toString(), if o is not null
    * Object.toString(o)
    * String.valueOf(o)
* Note that for array / vec of enums / bitfields, the raw integer
  value is dumped.

Bug: 33459772
Test: hidl_test_java

Change-Id: Ifb1ed519770b907e0a4e345b2c3109dc322a23b2
diff --git a/Type.cpp b/Type.cpp
index 71279c0..546d6ab 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -214,6 +214,13 @@
         << ");\n";
 }
 
+void Type::emitJavaDump(
+        Formatter &out,
+        const std::string &streamName,
+        const std::string &name) const {
+    out << streamName << ".append(" << name << ");\n";
+}
+
 bool Type::useParentInEmitResolveReferencesEmbedded() const {
     return needsResolveReferences();
 }