aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/java/java_helpers.cc
diff options
context:
space:
mode:
authorkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-04-18 00:02:12 +0000
committerkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-04-18 00:02:12 +0000
commitcfa2d8aa87cc0b22b5092a5fb3bf7e394f85cbf1 (patch)
tree77ee2f4d02dfb43187511f3eb5a37a00c2f6f5de /src/google/protobuf/compiler/java/java_helpers.cc
parenteb26a1efdef3f1f5e77807d456a08f3c76cc5207 (diff)
downloadprotobuf-cfa2d8aa87cc0b22b5092a5fb3bf7e394f85cbf1.tar.gz
protobuf-cfa2d8aa87cc0b22b5092a5fb3bf7e394f85cbf1.tar.bz2
protobuf-cfa2d8aa87cc0b22b5092a5fb3bf7e394f85cbf1.zip
Generate field number constants. Patch from Michael Poole.
Diffstat (limited to 'src/google/protobuf/compiler/java/java_helpers.cc')
-rw-r--r--src/google/protobuf/compiler/java/java_helpers.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc
index c1994352..6a107650 100644
--- a/src/google/protobuf/compiler/java/java_helpers.cc
+++ b/src/google/protobuf/compiler/java/java_helpers.cc
@@ -171,6 +171,12 @@ string ClassName(const FileDescriptor* descriptor) {
return result;
}
+string FieldConstantName(const FieldDescriptor *field) {
+ string name = field->name() + "_FIELD_NUMBER";
+ UpperString(&name);
+ return name;
+}
+
JavaType GetJavaType(FieldDescriptor::Type field_type) {
switch (field_type) {
case FieldDescriptor::TYPE_INT32: