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/ScalarType.h b/ScalarType.h
index 8b70d72..a8a5f68 100644
--- a/ScalarType.h
+++ b/ScalarType.h
@@ -85,6 +85,10 @@
const std::string &streamName,
const std::string &name) const;
+ void emitConvertToJavaHexString(
+ Formatter &out,
+ const std::string &name) const;
+
void emitJavaFieldReaderWriter(
Formatter &out,
size_t depth,