summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeff Davidson <jpd@google.com>2015-04-06 16:57:27 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-06 16:57:27 +0000
commiteff5d5b33b3ef8b655ce43e9f64578a8c8e4e482 (patch)
treef8b252def86c4bd71be3454b2542f72b9cd2a416 /src
parentaba240b005645cc557b21cff484928c3024b0fc3 (diff)
parent1d4b8b9fc9950152a1b235dfc83cf613a3b18ca4 (diff)
downloadexternal_protobuf-eff5d5b33b3ef8b655ce43e9f64578a8c8e4e482.zip
external_protobuf-eff5d5b33b3ef8b655ce43e9f64578a8c8e4e482.tar.gz
external_protobuf-eff5d5b33b3ef8b655ce43e9f64578a8c8e4e482.tar.bz2
am 1d4b8b9f: am ff882b40: Merge "Generate a CREATOR for each Parcelable message."
* commit '1d4b8b9fc9950152a1b235dfc83cf613a3b18ca4': Generate a CREATOR for each Parcelable message.
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_message.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_message.cc b/src/google/protobuf/compiler/javanano/javanano_message.cc
index 4026031..758c9e8 100644
--- a/src/google/protobuf/compiler/javanano/javanano_message.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_message.cc
@@ -154,6 +154,17 @@ void MessageGenerator::Generate(io::Printer* printer) {
}
printer->Indent();
+ if (params_.parcelable_messages()) {
+ printer->Print(
+ "\n"
+ "// Used by Parcelable\n"
+ "@SuppressWarnings({\"unused\"})\n"
+ "public static final android.os.Parcelable.Creator<$classname$> CREATOR =\n"
+ " new com.google.protobuf.nano.android.ParcelableMessageNanoCreator<\n"
+ " $classname$>($classname$.class);\n",
+ "classname", descriptor_->name());
+ }
+
// Nested types and extensions
for (int i = 0; i < descriptor_->extension_count(); i++) {
ExtensionGenerator(descriptor_->extension(i), params_).Generate(printer);