has_method support for primitive fields in java runtime. Changed: idl.h, FlatBufferBuilder.java , idl_gen_general.cpp, idl_parser.cpp, flatc.cpp (#5468)

* has_method support for primitive fields in java runtime

* adding the new flag to flatc

* addressing the review comments
This commit is contained in:
Edward
2019-08-19 12:46:48 -07:00
committed by Wouter van Oortmerssen
parent acc9990abd
commit a20e71ac96
5 changed files with 38 additions and 0 deletions

View File

@@ -1323,6 +1323,15 @@ class GeneralGenerator : public BaseGenerator {
}
}
}
if (parser_.opts.java_primitive_has_method &&
IsScalar(field.value.type.base_type) && !struct_def.fixed) {
auto vt_offset_constant = " public static final int VT_" +
MakeScreamingCamel(field.name) + " = " +
NumToString(field.value.offset) + ";";
code += vt_offset_constant;
code += "\n";
}
}
code += "\n";
flatbuffers::FieldDef *key_field = nullptr;