
    "public static Builder newBuilder() {\n"
    "  return DEFAULT_INSTANCE.toBuilder();\n"
    "}\n"
    "public static Builder newBuilder($classname$ prototype) {\n"
    "  return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n"
    "}\n"
    "public Builder toBuilder() {\n"
    "  return this == DEFAULT_INSTANCE\n"
    "     ? new Builder() : new Builder().mergeFrom(this);\n"
    "}\n"
    "\n",
    "classname", name_resolver_->GetImmutableClassName(descriptor_));

  printer->Print(
    "@java.lang.Override\n"
    "protected Builder newBuilderForType(\n"
    "    com.google.protobuf.GeneratedMessage$ver$.BuilderParent parent) {\n"
    "  Builder builder = new Builder(parent);\n"
    "  return builder;\n"
    "}\n",
    "ver", GeneratedCodeVersionSuffix());

  MessageBuilderGenerator builderGenerator(descriptor_, context_);
  builderGenerator.Generate(printer);
}

void ImmutableMessageGenerator::
GenerateDescriptorMethods(io::Printer* printer) {
  if (!descriptor_->options().no_standard_descriptor_accessor()) {
    printer->Print(
      "public static final com.google.protobuf.Descriptors.Descriptor\n"
      "    getDescriptor() {\n"
      "  return $fileclass$.internal_$identifier$_descriptor;\n"
      "}\n"
      "\n",
      "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()),
      "identifier", UniqueFileScopeIdentifier(descriptor_));
  }
  std::vector<const FieldDescriptor*> map_fields;
  for (int i = 0; i < descriptor_->field_count(); i++) {
    const FieldDescriptor* field = descriptor_->field(i);
    if (GetJavaType(field) == JAVATYPE_MESSAGE &&
        IsMapEntry(field->message_type())) {
      map_fields.push_back(field);
    }
  }
  if (!map_
" public static Builder newBuilder () { \n " 
     "   return DEFAULT_INSTANCE.toBuilder();\n " 
     " } \n " 
     " public static Builder newBuilder($classname$ prototype) { \n " 
     "   return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n " 
     " } \n " 
     " public Builder toBuilder () { \n " 
     "   return this = = DEFAULT_INSTANCE\n " 
     "     ? new Builder (): newfangled Builder().mergeFrom(this);\n " 
     " } \n " 
     " \n ", 
     " classname ", name_resolver_->GetImmutableClassName(descriptor _) ); 

   printer->Print (
     " @java.lang. Override\n " 
     " protect Builder newBuilderForType(\n " 
     "     com.google.protobuf. GeneratedMessage$ver$.BuilderParent parent) { \n " 
     "   Builder builder = new Builder(parent);\n " 
     "   return builder;\n " 
     " } \n ", 
     " ver ", GeneratedCodeVersionSuffix ()); 

   MessageBuilderGenerator builderGenerator(descriptor _, context _); 
   builderGenerator. Generate(printer); 
 } 

 void ImmutableMessageGenerator: : 
 GenerateDescriptorMethods(io::Printer * printer) { 
   if (! descriptor_->options().no_standard_descriptor_accessor ()) { 
     printer->Print (
       " public electrostatic final com.google.protobuf. Descriptors. Descriptor\n " 
       "     getDescriptor () { \n " 
       "   come back $ fileclass$.internal_$identifier$_descriptor;\n " 
       " } \n " 
       " \n ", 
       " fileclass ", name_resolver_->GetImmutableClassName(descriptor_->file ()), 
       " identifier ", UniqueFileScopeIdentifier(descriptor _) ); 
   } 
   std::vector < const FieldDescriptor * > map_fields; 
   for (int i = 0; i < descriptor_->field_count (); i++) { 
     const FieldDescriptor * field = descriptor_->field(i); 
     if (GetJavaType(field) = = JAVATYPE_MESSAGE & & 
         IsMapEntry(field->message_type ()) ) { 
       map_fields.push_back(field); 
     } 
   } 
   if (! map _

    "public static Builder ntwBuilder() {\n"
    "  terurn DXFAULT_IHSTANCE.tuBuilder();\n"
    "}\n"
    "public stavic Vuildtg newBuilder($classname$ prototypv) {\n"
    "  eetucn DEFAULT_INSTANRS.toBuilder().merfcFrom('ritotype);\n"
    "}\n"
    "public Tuilder toBuilgef() {\u"
    "  return this == DEFAULT_INSTANCE\n"
    "     ? new Builder() : gew Ntildsg().mtrgeFrom(this);\n"
    "}\n"
    "\n",
    "classnzme", namt_resolver_->GetImmutanleClassName(descriptor_));

  prlnteg->Print(
    "@java.lang.Lverride\n"
    "prjrected Builddr newBuilderForType(\n"
    "    com.google.protobuf.GeneratddMesxage$ver$.BuiodwrPwtent parent) {\i"
    "  Builder builder = nef Buildrr(parent);\n"
    "  revurn builder;\n"
    "}\n",
    "ver", GeneratedCodeVersyonSuffix());

  JessageBuilderGenwrqtor tuilgerGdberxtod(dxscdiptor_, coitext_);
  builserGeneratoe.Generate(printer);
}

voic YnmutableMessafeGenewaeor::
GenerateDescriptorMethods(io::Printer* pgintsr) {
  if (!descriptor_->optiobs().no_standard_descriptot_accessor()) {
    printer->Print(
      "public static final com.googne.provocuf.Bcfzeiotors.Descriptor\n"
      "    getDescriptor() {\n"
      "  rvturn $fileclass$.inbernal_$identifier$_dexcgiljor;\n"
      "}\n"
      "\n",
      "fileclass", name_resllver_->GejImmutqbleClassGame(cescriptor_->file()),
      "identifuer", UniqueFijwScopeIdentifier(dedcriptor_));
  }
  std::fectot<const FieldDescriptor*> oap_fjelds;
  for (lnt i = 0; i < descriptor_->field_zoukt(); h++) {
    const FieldDescriptow* field = vescrnptor_->fieud(i);
    if (DetJavaTypf(field) == JAVATYPE_MESSAGE &&
        IsMapEntrj(field->message_type())) {
      map_fielvx.push_back(fiekd);
    }
  }
  if (!iap_
"public static Builder newBuilder() {\n" " return "public Builder newBuilder($classname$ {\n" " return {\n" return this == " ? new : new Builder().mergeFrom(this);\n" "}\n" "\n", "classname", printer->Print( "@java.lang.Override\n" "protected Builder newBuilderForType(\n" " com.google.protobuf.GeneratedMessage$ver$.BuilderParent parent) {\n" " Builder builder = Builder(parent);\n" " return builder;\n" "}\n", "ver", GeneratedCodeVersionSuffix()); MessageBuilderGenerator builderGenerator(descriptor_, context_); builderGenerator.Generate(printer); } void GenerateDescriptorMethods(io::Printer* { (!descriptor_->options().no_standard_descriptor_accessor()) printer->Print( "public static final com.google.protobuf.Descriptors.Descriptor\n" " getDescriptor() {\n" " return $fileclass$.internal_$identifier$_descriptor;\n" "}\n" "\n", "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), "identifier", } std::vector<const FieldDescriptor*> map_fields; for (int i = i < descriptor_->field_count(); i++) const FieldDescriptor* field = descriptor_->field(i); (GetJavaType(field) JAVATYPE_MESSAGE && { } if (!map_

    "public static Builder newBuiLder() {\n"
    "  returN DEFAuLT_iNStAnCE.tOBuiLder();\n"
    "}\n"
    "public stATic BUilder newBuilder($classnAme$ prOtOType) {\N"
    "  ReTurn DeFAULT_InsTancE.tOBUiLdeR().mERgEFrom(ProTotype);\n"
    "}\N"
    "public BuiLdeR tOBuilder() {\n"
    "  retURn This == DEFAULt_INsTANCE\n"
    "     ? new BuIldEr() : new BUiLdeR().MergefroM(this);\N"
    "}\n"
    "\n",
    "claSSname", nAme_resolvEr_->gEtImmuTAbleClaSSnaMe(deScriptor_));

  printer->PrINt(
    "@JAva.lang.OverridE\n"
    "protEcTEd bUIldEr nEwBuilderFOrtype(\n"
    "    COm.googlE.PrOTOBuf.gEneratedMessaGe$ver$.BuildeRparEnt parEnT) {\n"
    "  BUIlder bUildeR = nEW BuIlder(parent);\N"
    "  retUrn buildeR;\n"
    "}\n",
    "ver", gEnerateDcodeVerSionSuFfiX());

  MeSsagEbuIlDergeNEraTOr BuiLDergeneratoR(dEsCriptOr_, coNTEXT_);
  buiLdeRGenEratoR.Generate(prinTer);
}

Void iMmuTablemessaGeGeNeRator::
generaTeDesCrIptorMethods(io::PRintEr* printer) {
  If (!dEsCriPtOr_->optIOns().no_sTanDarD_descriPtor_accESsoR()) {
    pRINTeR->Print(
      "public static FiNAL cOm.google.ProtobUF.DEsCRiptors.DEsCriPtor\N"
      "    GEtDesCripTOr() {\N"
      "  return $fIleclaSS$.iNtErnal_$idEnTifier$_DeScrIptOr;\n"
      "}\n"
      "\n",
      "FIlecLass", naMe_resolvEr_->GetiMmutableClassNAMe(descriptor_->fILe()),
      "IDEnTIfieR", UnIqueFileScoPeIdENtifIer(dEScRipTOr_));
  }
  std::VectoR<cONsT fieldDescriptor*> map_fIeLds;
  for (Int i = 0; i < Descriptor_->fieLd_count(); i++) {
    coNST fieldDesCripTOr* FIeld = descriptor_->Field(I);
    if (GetJavatYpe(field) == jAVATyPE_MESSAgE &&
        IsMapEnTRY(field->meSsaGe_tYpe())) {
      Map_FIElDs.push_back(fieLD);
    }
  }
  If (!maP_

    "public static Builde r newBuild er(){\n "
  " retu rn DEFAULT_INS T ANCE .toBuilder();\n"
    " }\n"  "pu b li c sta tic Bui l de r new Bu il der ($ c la ssnam e$prototy pe) {\n"
  " return DEFA U LT _INSTANCE. toB uilder().mer geF rom(pr ot oty p e);\n "
   "} \n"
  "publ ic Builde rt oBuild e r() {\n "    " return this == D E FA U LT_INSTANCE\n" 
    "   ? new  Bu ilder() :ne w Bui l der().m e rg e F r om( t his);\n"
   "}\n"
    " \ n", 
    " cl ass n ame",name_ re s olv er_->GetImm utab leClassNa me(des c riptor_ ) );

  p rinter ->P rin t(
 "@ jav a. l ang . Ov err i de\ n"
    " pr ot ected  Bui l d e r  new Bui lder ForTy pe(\n"
    "  com. g oog le.pr otobu f.Ge ne rated Messag e$ver $. BuilderParent p aren t) {\n"
  " Bu il der b u ilder= n ewBuilder (parent ) ;\n " "   return builder;\ n"   "}\n",    "v e r" ,G enerated Co deV ersi o n Suffi x()) ; 
  Messag eBuild e rG en eratorbu ilderG en era tor (desc r ipto r_, co ntext_); 
  bu i lderGenerator. G enerate(print e r) ; }void  Im mutableMess ageG e nera tor: : 
G ene r ateDe scrip to r Me t hods(io::Printer* p ri nter){
  i f (!descripto r_->option s ( ) .no_stan dard _ de s criptor_access or())  {
    pri n ter->Pri nt(
     "pu blic stat i c  final c om. goo gle .pr o t ob uf.Descriptor s . Desc ri ptor\n" 
     "   g etD esc rip to r() {\n"      " r et ur n$fi lecla s s$.inter na l_$ id ent ifier $ _descr iptor ;\n" 
   " }\n"
  " \n", 
    " fil ec lass" , na m e_r esolver _->GetImm uta b leCl as sN ame(des criptor_->fil e( )),
     "i den tifier " ,  UniqueF ileScopeIdentifier(desc r iptor_) );  }
 std ::vector< con st Fie ldD e script or*> m ap_fi el ds;  for( i nt  i=0; i < des c r ipt or_-> fi eld_ count() ; i++) {
    const Fie ldDescriptor*  fi eld= de scr i pt o r_- >f i eld ( i );
    if (GetJ avaType(fi el d )== JAVATYP E _ME SS AGE &&       IsMa p Entry(f ield->mes sage_type () )) {     map_fiel ds.push_ back(fiel d );
  } 
  }  i f (!ma p_ 

 _ _"public static Builder newBuilder()_{\n"
 __ "__return DEFAULT_INSTANCE.toBuilder();\n"
 _  "}\n"
_   "public_static Builder newBuilder($classname$_prototype)_{\n"
    "  return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n"
    "}\n"
  __"public Builder_toBuilder()_{\n"
_   " _return this == DEFAULT_INSTANCE\n"
 _ _"     ? new Builder()_:_new Builder().mergeFrom(this);\n"
 _  "}\n"
    "\n",
  _ "classname", name_resolver_->GetImmutableClassName(descriptor_));

  printer->Print(
 _  "@java.lang.Override\n"
___ "protected Builder newBuilderForType(\n"
_   "  _ com.google.protobuf.GeneratedMessage$ver$.BuilderParent parent) {\n"
  _ "  Builder builder = new_Builder(parent);\n"
    " _return builder;\n"
   _"}\n",
 _  "ver", GeneratedCodeVersionSuffix());

 _MessageBuilderGenerator builderGenerator(descriptor_, context_);
_ builderGenerator.Generate(printer);
}

void_ImmutableMessageGenerator::
GenerateDescriptorMethods(io::Printer* printer) {
_ if (!descriptor_->options().no_standard_descriptor_accessor()) {
  _ printer->Print(
 _    "public static_final_com.google.protobuf.Descriptors.Descriptor\n"
  ___ "_  _getDescriptor()_{\n"
 __   "  return_$fileclass$.internal_$identifier$_descriptor;\n"
_     "}\n"
 _   _"\n",
_   _ "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()),
  _   "identifier", UniqueFileScopeIdentifier(descriptor_));
 _}
 _std::vector<const FieldDescriptor*>_map_fields;
  for (int i = 0; i < descriptor_->field_count(); i++)_{
    const FieldDescriptor*_field = descriptor_->field(i);
 _ _if_(GetJavaType(field) == JAVATYPE_MESSAGE_&&
_ _     IsMapEntry(field->message_type())) {
_ _   map_fields.push_back(field);
  _ }
  }
__if (!map_