Initial commit of Java backend to hidl-gen.
Change-Id: I38b62637df74d3e5daf702a8996502d0d5726033
diff --git a/ScalarType.cpp b/ScalarType.cpp
index b15734b..bf111ca 100644
--- a/ScalarType.cpp
+++ b/ScalarType.cpp
@@ -39,6 +39,46 @@
return kName[mKind];
}
+std::string ScalarType::getJavaType() const {
+ static const char *const kName[] = {
+ "byte",
+ "boolean",
+ "long",
+ "byte",
+ "byte",
+ "short",
+ "short",
+ "int",
+ "int",
+ "long",
+ "long",
+ "float",
+ "double"
+ };
+
+ return kName[mKind];
+}
+
+std::string ScalarType::getJavaSuffix() const {
+ static const char *const kSuffix[] = {
+ "Int8",
+ "Int8",
+ "Pointer",
+ "Int8",
+ "Int8",
+ "Int16",
+ "Int16",
+ "Int32",
+ "Int32",
+ "Int64",
+ "Int64",
+ "Float",
+ "Double"
+ };
+
+ return kSuffix[mKind];
+}
+
void ScalarType::emitReaderWriter(
Formatter &out,
const std::string &name,