1 /* 2 * Copyright (C) 2010 The Libphonenumber Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * Definition of the class representing metadata for international telephone numbers. This class is 19 * hand created based on the class file compiled from phonemetadata.proto. Please refer to that file 20 * for detailed descriptions of the meaning of each field. 21 * 22 * <p>WARNING: This API isn't stable. It is considered libphonenumber-internal and can change at any 23 * time. We only declare it as public for easy inclusion in our build tools not in this package. 24 * Clients should not refer to this file, we do not commit to support backwards-compatibility or to 25 * warn about breaking changes. 26 */ 27 28 package com.google.i18n.phonenumbers; 29 30 import java.io.Externalizable; 31 import java.io.IOException; 32 import java.io.ObjectInput; 33 import java.io.ObjectOutput; 34 35 public final class Phonemetadata { Phonemetadata()36 private Phonemetadata() {} 37 public static class NumberFormat implements Externalizable { 38 private static final long serialVersionUID = 1; NumberFormat()39 public NumberFormat() {} 40 41 /** 42 * Provides a dummy builder to 'emulate' the API of the code generated by the latest version of 43 * Protocol Buffers. This lets BuildMetadataFromXml class to build with both this hand created 44 * class and the one generated by the latest version of Protocol Buffers. 45 */ 46 public static final class Builder extends NumberFormat { build()47 public NumberFormat build() { 48 return this; 49 } 50 mergeFrom(NumberFormat other)51 public Builder mergeFrom(NumberFormat other) { 52 if (other.hasPattern()) { 53 setPattern(other.getPattern()); 54 } 55 if (other.hasFormat()) { 56 setFormat(other.getFormat()); 57 } 58 for (int i = 0; i < other.leadingDigitsPatternSize(); i++) { 59 addLeadingDigitsPattern(other.getLeadingDigitsPattern(i)); 60 } 61 if (other.hasNationalPrefixFormattingRule()) { 62 setNationalPrefixFormattingRule(other.getNationalPrefixFormattingRule()); 63 } 64 if (other.hasDomesticCarrierCodeFormattingRule()) { 65 setDomesticCarrierCodeFormattingRule(other.getDomesticCarrierCodeFormattingRule()); 66 } 67 if (other.hasNationalPrefixOptionalWhenFormatting()) { 68 setNationalPrefixOptionalWhenFormatting(other.getNationalPrefixOptionalWhenFormatting()); 69 } 70 return this; 71 } 72 } 73 newBuilder()74 public static Builder newBuilder() { 75 return new Builder(); 76 } 77 78 // required string pattern = 1; 79 private boolean hasPattern; 80 private String pattern_ = ""; hasPattern()81 public boolean hasPattern() { return hasPattern; } getPattern()82 public String getPattern() { return pattern_; } setPattern(String value)83 public NumberFormat setPattern(String value) { 84 hasPattern = true; 85 pattern_ = value; 86 return this; 87 } 88 89 // required string format = 2; 90 private boolean hasFormat; 91 private String format_ = ""; hasFormat()92 public boolean hasFormat() { return hasFormat; } getFormat()93 public String getFormat() { return format_; } setFormat(String value)94 public NumberFormat setFormat(String value) { 95 hasFormat = true; 96 format_ = value; 97 return this; 98 } 99 100 // repeated string leading_digits_pattern = 3; 101 private java.util.List<String> leadingDigitsPattern_ = new java.util.ArrayList<String>(); leadingDigitPatterns()102 public java.util.List<String> leadingDigitPatterns() { 103 return leadingDigitsPattern_; 104 } 105 @Deprecated leadingDigitsPatternSize()106 public int leadingDigitsPatternSize() { return getLeadingDigitsPatternCount(); } getLeadingDigitsPatternCount()107 public int getLeadingDigitsPatternCount() { return leadingDigitsPattern_.size(); } getLeadingDigitsPattern(int index)108 public String getLeadingDigitsPattern(int index) { 109 return leadingDigitsPattern_.get(index); 110 } addLeadingDigitsPattern(String value)111 public NumberFormat addLeadingDigitsPattern(String value) { 112 if (value == null) { 113 throw new NullPointerException(); 114 } 115 leadingDigitsPattern_.add(value); 116 return this; 117 } 118 119 // optional string national_prefix_formatting_rule = 4; 120 private boolean hasNationalPrefixFormattingRule; 121 private String nationalPrefixFormattingRule_ = ""; hasNationalPrefixFormattingRule()122 public boolean hasNationalPrefixFormattingRule() { return hasNationalPrefixFormattingRule; } getNationalPrefixFormattingRule()123 public String getNationalPrefixFormattingRule() { return nationalPrefixFormattingRule_; } setNationalPrefixFormattingRule(String value)124 public NumberFormat setNationalPrefixFormattingRule(String value) { 125 hasNationalPrefixFormattingRule = true; 126 nationalPrefixFormattingRule_ = value; 127 return this; 128 } clearNationalPrefixFormattingRule()129 public NumberFormat clearNationalPrefixFormattingRule() { 130 hasNationalPrefixFormattingRule = false; 131 nationalPrefixFormattingRule_ = ""; 132 return this; 133 } 134 135 // optional bool national_prefix_optional_when_formatting = 6 [default = false]; 136 private boolean hasNationalPrefixOptionalWhenFormatting; 137 private boolean nationalPrefixOptionalWhenFormatting_ = false; hasNationalPrefixOptionalWhenFormatting()138 public boolean hasNationalPrefixOptionalWhenFormatting() { 139 return hasNationalPrefixOptionalWhenFormatting; } getNationalPrefixOptionalWhenFormatting()140 public boolean getNationalPrefixOptionalWhenFormatting() { 141 return nationalPrefixOptionalWhenFormatting_; } setNationalPrefixOptionalWhenFormatting(boolean value)142 public NumberFormat setNationalPrefixOptionalWhenFormatting(boolean value) { 143 hasNationalPrefixOptionalWhenFormatting = true; 144 nationalPrefixOptionalWhenFormatting_ = value; 145 return this; 146 } 147 148 // optional string domestic_carrier_code_formatting_rule = 5; 149 private boolean hasDomesticCarrierCodeFormattingRule; 150 private String domesticCarrierCodeFormattingRule_ = ""; hasDomesticCarrierCodeFormattingRule()151 public boolean hasDomesticCarrierCodeFormattingRule() { 152 return hasDomesticCarrierCodeFormattingRule; } getDomesticCarrierCodeFormattingRule()153 public String getDomesticCarrierCodeFormattingRule() { 154 return domesticCarrierCodeFormattingRule_; } setDomesticCarrierCodeFormattingRule(String value)155 public NumberFormat setDomesticCarrierCodeFormattingRule(String value) { 156 hasDomesticCarrierCodeFormattingRule = true; 157 domesticCarrierCodeFormattingRule_ = value; 158 return this; 159 } 160 writeExternal(ObjectOutput objectOutput)161 public void writeExternal(ObjectOutput objectOutput) throws IOException { 162 objectOutput.writeUTF(pattern_); 163 objectOutput.writeUTF(format_); 164 int leadingDigitsPatternSize = leadingDigitsPatternSize(); 165 objectOutput.writeInt(leadingDigitsPatternSize); 166 for (int i = 0; i < leadingDigitsPatternSize; i++) { 167 objectOutput.writeUTF(leadingDigitsPattern_.get(i)); 168 } 169 170 objectOutput.writeBoolean(hasNationalPrefixFormattingRule); 171 if (hasNationalPrefixFormattingRule) { 172 objectOutput.writeUTF(nationalPrefixFormattingRule_); 173 } 174 objectOutput.writeBoolean(hasDomesticCarrierCodeFormattingRule); 175 if (hasDomesticCarrierCodeFormattingRule) { 176 objectOutput.writeUTF(domesticCarrierCodeFormattingRule_); 177 } 178 objectOutput.writeBoolean(nationalPrefixOptionalWhenFormatting_); 179 } 180 readExternal(ObjectInput objectInput)181 public void readExternal(ObjectInput objectInput) throws IOException { 182 setPattern(objectInput.readUTF()); 183 setFormat(objectInput.readUTF()); 184 int leadingDigitsPatternSize = objectInput.readInt(); 185 for (int i = 0; i < leadingDigitsPatternSize; i++) { 186 leadingDigitsPattern_.add(objectInput.readUTF()); 187 } 188 if (objectInput.readBoolean()) { 189 setNationalPrefixFormattingRule(objectInput.readUTF()); 190 } 191 if (objectInput.readBoolean()) { 192 setDomesticCarrierCodeFormattingRule(objectInput.readUTF()); 193 } 194 setNationalPrefixOptionalWhenFormatting(objectInput.readBoolean()); 195 } 196 } 197 198 public static class PhoneNumberDesc implements Externalizable { 199 private static final long serialVersionUID = 1; PhoneNumberDesc()200 public PhoneNumberDesc() {} 201 202 /** 203 * Provides a dummy builder. 204 * 205 * @see NumberFormat.Builder 206 */ 207 public static final class Builder extends PhoneNumberDesc { build()208 public PhoneNumberDesc build() { 209 return this; 210 } 211 mergeFrom(PhoneNumberDesc other)212 public Builder mergeFrom(PhoneNumberDesc other) { 213 if (other.hasNationalNumberPattern()) { 214 setNationalNumberPattern(other.getNationalNumberPattern()); 215 } 216 for (int i = 0; i < other.getPossibleLengthCount(); i++) { 217 addPossibleLength(other.getPossibleLength(i)); 218 } 219 for (int i = 0; i < other.getPossibleLengthLocalOnlyCount(); i++) { 220 addPossibleLengthLocalOnly(other.getPossibleLengthLocalOnly(i)); 221 } 222 if (other.hasExampleNumber()) { 223 setExampleNumber(other.getExampleNumber()); 224 } 225 return this; 226 } 227 } 228 newBuilder()229 public static Builder newBuilder() { 230 return new Builder(); 231 } 232 233 // optional string national_number_pattern = 2; 234 private boolean hasNationalNumberPattern; 235 private String nationalNumberPattern_ = ""; hasNationalNumberPattern()236 public boolean hasNationalNumberPattern() { return hasNationalNumberPattern; } getNationalNumberPattern()237 public String getNationalNumberPattern() { return nationalNumberPattern_; } setNationalNumberPattern(String value)238 public PhoneNumberDesc setNationalNumberPattern(String value) { 239 hasNationalNumberPattern = true; 240 nationalNumberPattern_ = value; 241 return this; 242 } clearNationalNumberPattern()243 public PhoneNumberDesc clearNationalNumberPattern() { 244 hasNationalNumberPattern = false; 245 nationalNumberPattern_ = ""; 246 return this; 247 } 248 249 // repeated int32 possible_length = 9; 250 private java.util.List<Integer> possibleLength_ = new java.util.ArrayList<Integer>(); getPossibleLengthList()251 public java.util.List<Integer> getPossibleLengthList() { 252 return possibleLength_; 253 } getPossibleLengthCount()254 public int getPossibleLengthCount() { return possibleLength_.size(); } getPossibleLength(int index)255 public int getPossibleLength(int index) { 256 return possibleLength_.get(index); 257 } addPossibleLength(int value)258 public PhoneNumberDesc addPossibleLength(int value) { 259 possibleLength_.add(value); 260 return this; 261 } clearPossibleLength()262 public PhoneNumberDesc clearPossibleLength() { 263 possibleLength_.clear(); 264 return this; 265 } 266 267 // repeated int32 possible_length_local_only = 10; 268 private java.util.List<Integer> possibleLengthLocalOnly_ = new java.util.ArrayList<Integer>(); getPossibleLengthLocalOnlyList()269 public java.util.List<Integer> getPossibleLengthLocalOnlyList() { 270 return possibleLengthLocalOnly_; 271 } getPossibleLengthLocalOnlyCount()272 public int getPossibleLengthLocalOnlyCount() { return possibleLengthLocalOnly_.size(); } getPossibleLengthLocalOnly(int index)273 public int getPossibleLengthLocalOnly(int index) { 274 return possibleLengthLocalOnly_.get(index); 275 } addPossibleLengthLocalOnly(int value)276 public PhoneNumberDesc addPossibleLengthLocalOnly(int value) { 277 possibleLengthLocalOnly_.add(value); 278 return this; 279 } clearPossibleLengthLocalOnly()280 public PhoneNumberDesc clearPossibleLengthLocalOnly() { 281 possibleLengthLocalOnly_.clear(); 282 return this; 283 } 284 285 // optional string example_number = 6; 286 private boolean hasExampleNumber; 287 private String exampleNumber_ = ""; hasExampleNumber()288 public boolean hasExampleNumber() { return hasExampleNumber; } getExampleNumber()289 public String getExampleNumber() { return exampleNumber_; } setExampleNumber(String value)290 public PhoneNumberDesc setExampleNumber(String value) { 291 hasExampleNumber = true; 292 exampleNumber_ = value; 293 return this; 294 } clearExampleNumber()295 public PhoneNumberDesc clearExampleNumber() { 296 hasExampleNumber = false; 297 exampleNumber_ = ""; 298 return this; 299 } 300 exactlySameAs(PhoneNumberDesc other)301 public boolean exactlySameAs(PhoneNumberDesc other) { 302 return nationalNumberPattern_.equals(other.nationalNumberPattern_) && 303 possibleLength_.equals(other.possibleLength_) && 304 possibleLengthLocalOnly_.equals(other.possibleLengthLocalOnly_) && 305 exampleNumber_.equals(other.exampleNumber_); 306 } 307 writeExternal(ObjectOutput objectOutput)308 public void writeExternal(ObjectOutput objectOutput) throws IOException { 309 objectOutput.writeBoolean(hasNationalNumberPattern); 310 if (hasNationalNumberPattern) { 311 objectOutput.writeUTF(nationalNumberPattern_); 312 } 313 314 int possibleLengthSize = getPossibleLengthCount(); 315 objectOutput.writeInt(possibleLengthSize); 316 for (int i = 0; i < possibleLengthSize; i++) { 317 objectOutput.writeInt(possibleLength_.get(i)); 318 } 319 320 int possibleLengthLocalOnlySize = getPossibleLengthLocalOnlyCount(); 321 objectOutput.writeInt(possibleLengthLocalOnlySize); 322 for (int i = 0; i < possibleLengthLocalOnlySize; i++) { 323 objectOutput.writeInt(possibleLengthLocalOnly_.get(i)); 324 } 325 326 objectOutput.writeBoolean(hasExampleNumber); 327 if (hasExampleNumber) { 328 objectOutput.writeUTF(exampleNumber_); 329 } 330 } 331 readExternal(ObjectInput objectInput)332 public void readExternal(ObjectInput objectInput) throws IOException { 333 if (objectInput.readBoolean()) { 334 setNationalNumberPattern(objectInput.readUTF()); 335 } 336 337 int possibleLengthSize = objectInput.readInt(); 338 for (int i = 0; i < possibleLengthSize; i++) { 339 possibleLength_.add(objectInput.readInt()); 340 } 341 342 int possibleLengthLocalOnlySize = objectInput.readInt(); 343 for (int i = 0; i < possibleLengthLocalOnlySize; i++) { 344 possibleLengthLocalOnly_.add(objectInput.readInt()); 345 } 346 347 if (objectInput.readBoolean()) { 348 setExampleNumber(objectInput.readUTF()); 349 } 350 } 351 } 352 353 public static class PhoneMetadata implements Externalizable { 354 private static final long serialVersionUID = 1; PhoneMetadata()355 public PhoneMetadata() {} 356 357 /** 358 * Provides a dummy builder. 359 * 360 * @see NumberFormat.Builder 361 */ 362 public static final class Builder extends PhoneMetadata { build()363 public PhoneMetadata build() { 364 return this; 365 } 366 setId(String value)367 public Builder setId(String value) { 368 super.setId(value); 369 return this; 370 } 371 setInternationalPrefix(String value)372 public Builder setInternationalPrefix(String value) { 373 super.setInternationalPrefix(value); 374 return this; 375 } 376 } newBuilder()377 public static Builder newBuilder() { 378 return new Builder(); 379 } 380 381 // optional PhoneNumberDesc general_desc = 1; 382 private boolean hasGeneralDesc; 383 private PhoneNumberDesc generalDesc_ = null; hasGeneralDesc()384 public boolean hasGeneralDesc() { return hasGeneralDesc; } getGeneralDesc()385 public PhoneNumberDesc getGeneralDesc() { return generalDesc_; } getGeneralDescBuilder()386 public PhoneNumberDesc getGeneralDescBuilder() { 387 if (generalDesc_ == null) { 388 generalDesc_ = new PhoneNumberDesc(); 389 } 390 return generalDesc_ ; 391 } setGeneralDesc(PhoneNumberDesc value)392 public PhoneMetadata setGeneralDesc(PhoneNumberDesc value) { 393 if (value == null) { 394 throw new NullPointerException(); 395 } 396 hasGeneralDesc = true; 397 generalDesc_ = value; 398 return this; 399 } 400 401 // optional PhoneNumberDesc fixed_line = 2; 402 private boolean hasFixedLine; 403 private PhoneNumberDesc fixedLine_ = null; hasFixedLine()404 public boolean hasFixedLine() { return hasFixedLine; } getFixedLine()405 public PhoneNumberDesc getFixedLine() { return fixedLine_; } setFixedLine(PhoneNumberDesc value)406 public PhoneMetadata setFixedLine(PhoneNumberDesc value) { 407 if (value == null) { 408 throw new NullPointerException(); 409 } 410 hasFixedLine = true; 411 fixedLine_ = value; 412 return this; 413 } 414 415 // optional PhoneNumberDesc mobile = 3; 416 private boolean hasMobile; 417 private PhoneNumberDesc mobile_ = null; hasMobile()418 public boolean hasMobile() { return hasMobile; } getMobile()419 public PhoneNumberDesc getMobile() { return mobile_; } setMobile(PhoneNumberDesc value)420 public PhoneMetadata setMobile(PhoneNumberDesc value) { 421 if (value == null) { 422 throw new NullPointerException(); 423 } 424 hasMobile = true; 425 mobile_ = value; 426 return this; 427 } 428 429 // optional PhoneNumberDesc toll_free = 4; 430 private boolean hasTollFree; 431 private PhoneNumberDesc tollFree_ = null; hasTollFree()432 public boolean hasTollFree() { return hasTollFree; } getTollFree()433 public PhoneNumberDesc getTollFree() { return tollFree_; } setTollFree(PhoneNumberDesc value)434 public PhoneMetadata setTollFree(PhoneNumberDesc value) { 435 if (value == null) { 436 throw new NullPointerException(); 437 } 438 hasTollFree = true; 439 tollFree_ = value; 440 return this; 441 } 442 443 // optional PhoneNumberDesc premium_rate = 5; 444 private boolean hasPremiumRate; 445 private PhoneNumberDesc premiumRate_ = null; hasPremiumRate()446 public boolean hasPremiumRate() { return hasPremiumRate; } getPremiumRate()447 public PhoneNumberDesc getPremiumRate() { return premiumRate_; } setPremiumRate(PhoneNumberDesc value)448 public PhoneMetadata setPremiumRate(PhoneNumberDesc value) { 449 if (value == null) { 450 throw new NullPointerException(); 451 } 452 hasPremiumRate = true; 453 premiumRate_ = value; 454 return this; 455 } 456 457 // optional PhoneNumberDesc shared_cost = 6; 458 private boolean hasSharedCost; 459 private PhoneNumberDesc sharedCost_ = null; hasSharedCost()460 public boolean hasSharedCost() { return hasSharedCost; } getSharedCost()461 public PhoneNumberDesc getSharedCost() { return sharedCost_; } setSharedCost(PhoneNumberDesc value)462 public PhoneMetadata setSharedCost(PhoneNumberDesc value) { 463 if (value == null) { 464 throw new NullPointerException(); 465 } 466 hasSharedCost = true; 467 sharedCost_ = value; 468 return this; 469 } 470 471 // optional PhoneNumberDesc personal_number = 7; 472 private boolean hasPersonalNumber; 473 private PhoneNumberDesc personalNumber_ = null; hasPersonalNumber()474 public boolean hasPersonalNumber() { return hasPersonalNumber; } getPersonalNumber()475 public PhoneNumberDesc getPersonalNumber() { return personalNumber_; } setPersonalNumber(PhoneNumberDesc value)476 public PhoneMetadata setPersonalNumber(PhoneNumberDesc value) { 477 if (value == null) { 478 throw new NullPointerException(); 479 } 480 hasPersonalNumber = true; 481 personalNumber_ = value; 482 return this; 483 } 484 485 // optional PhoneNumberDesc voip = 8; 486 private boolean hasVoip; 487 private PhoneNumberDesc voip_ = null; hasVoip()488 public boolean hasVoip() { return hasVoip; } getVoip()489 public PhoneNumberDesc getVoip() { return voip_; } setVoip(PhoneNumberDesc value)490 public PhoneMetadata setVoip(PhoneNumberDesc value) { 491 if (value == null) { 492 throw new NullPointerException(); 493 } 494 hasVoip = true; 495 voip_ = value; 496 return this; 497 } 498 499 // optional PhoneNumberDesc pager = 21; 500 private boolean hasPager; 501 private PhoneNumberDesc pager_ = null; hasPager()502 public boolean hasPager() { return hasPager; } getPager()503 public PhoneNumberDesc getPager() { return pager_; } setPager(PhoneNumberDesc value)504 public PhoneMetadata setPager(PhoneNumberDesc value) { 505 if (value == null) { 506 throw new NullPointerException(); 507 } 508 hasPager = true; 509 pager_ = value; 510 return this; 511 } 512 513 // optional PhoneNumberDesc uan = 25; 514 private boolean hasUan; 515 private PhoneNumberDesc uan_ = null; hasUan()516 public boolean hasUan() { return hasUan; } getUan()517 public PhoneNumberDesc getUan() { return uan_; } setUan(PhoneNumberDesc value)518 public PhoneMetadata setUan(PhoneNumberDesc value) { 519 if (value == null) { 520 throw new NullPointerException(); 521 } 522 hasUan = true; 523 uan_ = value; 524 return this; 525 } 526 527 // optional PhoneNumberDesc emergency = 27; 528 private boolean hasEmergency; 529 private PhoneNumberDesc emergency_ = null; hasEmergency()530 public boolean hasEmergency() { return hasEmergency; } getEmergency()531 public PhoneNumberDesc getEmergency() { return emergency_; } setEmergency(PhoneNumberDesc value)532 public PhoneMetadata setEmergency(PhoneNumberDesc value) { 533 if (value == null) { 534 throw new NullPointerException(); 535 } 536 hasEmergency = true; 537 emergency_ = value; 538 return this; 539 } 540 541 // optional PhoneNumberDesc voicemail = 28; 542 private boolean hasVoicemail; 543 private PhoneNumberDesc voicemail_ = null; hasVoicemail()544 public boolean hasVoicemail() { return hasVoicemail; } getVoicemail()545 public PhoneNumberDesc getVoicemail() { return voicemail_; } setVoicemail(PhoneNumberDesc value)546 public PhoneMetadata setVoicemail(PhoneNumberDesc value) { 547 if (value == null) { 548 throw new NullPointerException(); 549 } 550 hasVoicemail = true; 551 voicemail_ = value; 552 return this; 553 } 554 555 // optional PhoneNumberDesc short_code = 29; 556 private boolean hasShortCode; 557 private PhoneNumberDesc shortCode_ = null; hasShortCode()558 public boolean hasShortCode() { return hasShortCode; } getShortCode()559 public PhoneNumberDesc getShortCode() { return shortCode_; } setShortCode(PhoneNumberDesc value)560 public PhoneMetadata setShortCode(PhoneNumberDesc value) { 561 if (value == null) { 562 throw new NullPointerException(); 563 } 564 hasShortCode = true; 565 shortCode_ = value; 566 return this; 567 } 568 569 // optional PhoneNumberDesc standard_rate = 30; 570 private boolean hasStandardRate; 571 private PhoneNumberDesc standardRate_ = null; hasStandardRate()572 public boolean hasStandardRate() { return hasStandardRate; } getStandardRate()573 public PhoneNumberDesc getStandardRate() { return standardRate_; } setStandardRate(PhoneNumberDesc value)574 public PhoneMetadata setStandardRate(PhoneNumberDesc value) { 575 if (value == null) { 576 throw new NullPointerException(); 577 } 578 hasStandardRate = true; 579 standardRate_ = value; 580 return this; 581 } 582 583 // optional PhoneNumberDesc carrier_specific = 31; 584 private boolean hasCarrierSpecific; 585 private PhoneNumberDesc carrierSpecific_ = null; hasCarrierSpecific()586 public boolean hasCarrierSpecific() { return hasCarrierSpecific; } getCarrierSpecific()587 public PhoneNumberDesc getCarrierSpecific() { return carrierSpecific_; } setCarrierSpecific(PhoneNumberDesc value)588 public PhoneMetadata setCarrierSpecific(PhoneNumberDesc value) { 589 if (value == null) { 590 throw new NullPointerException(); 591 } 592 hasCarrierSpecific = true; 593 carrierSpecific_ = value; 594 return this; 595 } 596 597 // optional PhoneNumberDesc sms_services = 33; 598 private boolean hasSmsServices; 599 private PhoneNumberDesc smsServices_ = null; hasSmsServices()600 public boolean hasSmsServices() { return hasSmsServices; } getSmsServices()601 public PhoneNumberDesc getSmsServices() { return smsServices_; } setSmsServices(PhoneNumberDesc value)602 public PhoneMetadata setSmsServices(PhoneNumberDesc value) { 603 if (value == null) { 604 throw new NullPointerException(); 605 } 606 hasSmsServices = true; 607 smsServices_ = value; 608 return this; 609 } 610 611 // optional PhoneNumberDesc noInternationalDialling = 24; 612 private boolean hasNoInternationalDialling; 613 private PhoneNumberDesc noInternationalDialling_ = null; hasNoInternationalDialling()614 public boolean hasNoInternationalDialling() { return hasNoInternationalDialling; } getNoInternationalDialling()615 public PhoneNumberDesc getNoInternationalDialling() { return noInternationalDialling_; } setNoInternationalDialling(PhoneNumberDesc value)616 public PhoneMetadata setNoInternationalDialling(PhoneNumberDesc value) { 617 if (value == null) { 618 throw new NullPointerException(); 619 } 620 hasNoInternationalDialling = true; 621 noInternationalDialling_ = value; 622 return this; 623 } 624 625 // required string id = 9; 626 private boolean hasId; 627 private String id_ = ""; hasId()628 public boolean hasId() { return hasId; } getId()629 public String getId() { return id_; } setId(String value)630 public PhoneMetadata setId(String value) { 631 hasId = true; 632 id_ = value; 633 return this; 634 } 635 636 // optional int32 country_code = 10; 637 private boolean hasCountryCode; 638 private int countryCode_ = 0; hasCountryCode()639 public boolean hasCountryCode() { return hasCountryCode; } getCountryCode()640 public int getCountryCode() { return countryCode_; } setCountryCode(int value)641 public PhoneMetadata setCountryCode(int value) { 642 hasCountryCode = true; 643 countryCode_ = value; 644 return this; 645 } 646 647 // optional string international_prefix = 11; 648 private boolean hasInternationalPrefix; 649 private String internationalPrefix_ = ""; hasInternationalPrefix()650 public boolean hasInternationalPrefix() { return hasInternationalPrefix; } getInternationalPrefix()651 public String getInternationalPrefix() { return internationalPrefix_; } setInternationalPrefix(String value)652 public PhoneMetadata setInternationalPrefix(String value) { 653 hasInternationalPrefix = true; 654 internationalPrefix_ = value; 655 return this; 656 } 657 658 // optional string preferred_international_prefix = 17; 659 private boolean hasPreferredInternationalPrefix; 660 private String preferredInternationalPrefix_ = ""; hasPreferredInternationalPrefix()661 public boolean hasPreferredInternationalPrefix() { return hasPreferredInternationalPrefix; } getPreferredInternationalPrefix()662 public String getPreferredInternationalPrefix() { return preferredInternationalPrefix_; } setPreferredInternationalPrefix(String value)663 public PhoneMetadata setPreferredInternationalPrefix(String value) { 664 hasPreferredInternationalPrefix = true; 665 preferredInternationalPrefix_ = value; 666 return this; 667 } clearPreferredInternationalPrefix()668 public PhoneMetadata clearPreferredInternationalPrefix() { 669 hasPreferredInternationalPrefix = false; 670 preferredInternationalPrefix_ = ""; 671 return this; 672 } 673 674 // optional string national_prefix = 12; 675 private boolean hasNationalPrefix; 676 private String nationalPrefix_ = ""; hasNationalPrefix()677 public boolean hasNationalPrefix() { return hasNationalPrefix; } getNationalPrefix()678 public String getNationalPrefix() { return nationalPrefix_; } setNationalPrefix(String value)679 public PhoneMetadata setNationalPrefix(String value) { 680 hasNationalPrefix = true; 681 nationalPrefix_ = value; 682 return this; 683 } clearNationalPrefix()684 public PhoneMetadata clearNationalPrefix() { 685 hasNationalPrefix = false; 686 nationalPrefix_ = ""; 687 return this; 688 } 689 690 // optional string preferred_extn_prefix = 13; 691 private boolean hasPreferredExtnPrefix; 692 private String preferredExtnPrefix_ = ""; hasPreferredExtnPrefix()693 public boolean hasPreferredExtnPrefix() { return hasPreferredExtnPrefix; } getPreferredExtnPrefix()694 public String getPreferredExtnPrefix() { return preferredExtnPrefix_; } setPreferredExtnPrefix(String value)695 public PhoneMetadata setPreferredExtnPrefix(String value) { 696 hasPreferredExtnPrefix = true; 697 preferredExtnPrefix_ = value; 698 return this; 699 } clearPreferredExtnPrefix()700 public PhoneMetadata clearPreferredExtnPrefix() { 701 hasPreferredExtnPrefix = false; 702 preferredExtnPrefix_ = ""; 703 return this; 704 } 705 706 // optional string national_prefix_for_parsing = 15; 707 private boolean hasNationalPrefixForParsing; 708 private String nationalPrefixForParsing_ = ""; hasNationalPrefixForParsing()709 public boolean hasNationalPrefixForParsing() { return hasNationalPrefixForParsing; } getNationalPrefixForParsing()710 public String getNationalPrefixForParsing() { return nationalPrefixForParsing_; } setNationalPrefixForParsing(String value)711 public PhoneMetadata setNationalPrefixForParsing(String value) { 712 hasNationalPrefixForParsing = true; 713 nationalPrefixForParsing_ = value; 714 return this; 715 } 716 717 // optional string national_prefix_transform_rule = 16; 718 private boolean hasNationalPrefixTransformRule; 719 private String nationalPrefixTransformRule_ = ""; hasNationalPrefixTransformRule()720 public boolean hasNationalPrefixTransformRule() { return hasNationalPrefixTransformRule; } getNationalPrefixTransformRule()721 public String getNationalPrefixTransformRule() { return nationalPrefixTransformRule_; } setNationalPrefixTransformRule(String value)722 public PhoneMetadata setNationalPrefixTransformRule(String value) { 723 hasNationalPrefixTransformRule = true; 724 nationalPrefixTransformRule_ = value; 725 return this; 726 } clearNationalPrefixTransformRule()727 public PhoneMetadata clearNationalPrefixTransformRule() { 728 hasNationalPrefixTransformRule = false; 729 nationalPrefixTransformRule_ = ""; 730 return this; 731 } 732 733 // optional bool same_mobile_and_fixed_line_pattern = 18 [default = false]; 734 private boolean hasSameMobileAndFixedLinePattern; 735 private boolean sameMobileAndFixedLinePattern_ = false; hasSameMobileAndFixedLinePattern()736 public boolean hasSameMobileAndFixedLinePattern() { return hasSameMobileAndFixedLinePattern; } getSameMobileAndFixedLinePattern()737 public boolean getSameMobileAndFixedLinePattern() { return sameMobileAndFixedLinePattern_; } setSameMobileAndFixedLinePattern(boolean value)738 public PhoneMetadata setSameMobileAndFixedLinePattern(boolean value) { 739 hasSameMobileAndFixedLinePattern = true; 740 sameMobileAndFixedLinePattern_ = value; 741 return this; 742 } clearSameMobileAndFixedLinePattern()743 public PhoneMetadata clearSameMobileAndFixedLinePattern() { 744 hasSameMobileAndFixedLinePattern = false; 745 sameMobileAndFixedLinePattern_ = false; 746 return this; 747 } 748 749 // repeated NumberFormat number_format = 19; 750 private java.util.List<NumberFormat> numberFormat_ = new java.util.ArrayList<NumberFormat>(); 751 @Deprecated numberFormats()752 public java.util.List<NumberFormat> numberFormats() { 753 return getNumberFormatList(); 754 } getNumberFormatList()755 public java.util.List<NumberFormat> getNumberFormatList() { 756 return numberFormat_; 757 } 758 @Deprecated numberFormatSize()759 public int numberFormatSize() { return getNumberFormatCount(); } getNumberFormatCount()760 public int getNumberFormatCount() { return numberFormat_.size(); } getNumberFormat(int index)761 public NumberFormat getNumberFormat(int index) { 762 return numberFormat_.get(index); 763 } addNumberFormat(NumberFormat value)764 public PhoneMetadata addNumberFormat(NumberFormat value) { 765 if (value == null) { 766 throw new NullPointerException(); 767 } 768 numberFormat_.add(value); 769 return this; 770 } 771 772 // repeated NumberFormat intl_number_format = 20; 773 private java.util.List<NumberFormat> intlNumberFormat_ = 774 new java.util.ArrayList<NumberFormat>(); 775 @Deprecated intlNumberFormats()776 public java.util.List<NumberFormat> intlNumberFormats() { 777 return getIntlNumberFormatList(); 778 } getIntlNumberFormatList()779 public java.util.List<NumberFormat> getIntlNumberFormatList() { 780 return intlNumberFormat_; 781 } 782 @Deprecated intlNumberFormatSize()783 public int intlNumberFormatSize() { return getIntlNumberFormatCount(); } getIntlNumberFormatCount()784 public int getIntlNumberFormatCount() { return intlNumberFormat_.size(); } getIntlNumberFormat(int index)785 public NumberFormat getIntlNumberFormat(int index) { 786 return intlNumberFormat_.get(index); 787 } 788 addIntlNumberFormat(NumberFormat value)789 public PhoneMetadata addIntlNumberFormat(NumberFormat value) { 790 if (value == null) { 791 throw new NullPointerException(); 792 } 793 intlNumberFormat_.add(value); 794 return this; 795 } clearIntlNumberFormat()796 public PhoneMetadata clearIntlNumberFormat() { 797 intlNumberFormat_.clear(); 798 return this; 799 } 800 801 // optional bool main_country_for_code = 22 [default = false]; 802 private boolean hasMainCountryForCode; 803 private boolean mainCountryForCode_ = false; hasMainCountryForCode()804 public boolean hasMainCountryForCode() { return hasMainCountryForCode; } isMainCountryForCode()805 public boolean isMainCountryForCode() { return mainCountryForCode_; } 806 // Method that lets this class have the same interface as the one generated by Protocol Buffers 807 // which is used by C++ build tools. getMainCountryForCode()808 public boolean getMainCountryForCode() { return mainCountryForCode_; } setMainCountryForCode(boolean value)809 public PhoneMetadata setMainCountryForCode(boolean value) { 810 hasMainCountryForCode = true; 811 mainCountryForCode_ = value; 812 return this; 813 } clearMainCountryForCode()814 public PhoneMetadata clearMainCountryForCode() { 815 hasMainCountryForCode = false; 816 mainCountryForCode_ = false; 817 return this; 818 } 819 820 // optional string leading_digits = 23; 821 private boolean hasLeadingDigits; 822 private String leadingDigits_ = ""; hasLeadingDigits()823 public boolean hasLeadingDigits() { return hasLeadingDigits; } getLeadingDigits()824 public String getLeadingDigits() { return leadingDigits_; } setLeadingDigits(String value)825 public PhoneMetadata setLeadingDigits(String value) { 826 hasLeadingDigits = true; 827 leadingDigits_ = value; 828 return this; 829 } 830 831 // optional bool leading_zero_possible = 26 [default = false]; 832 private boolean hasLeadingZeroPossible; 833 private boolean leadingZeroPossible_ = false; hasLeadingZeroPossible()834 public boolean hasLeadingZeroPossible() { return hasLeadingZeroPossible; } isLeadingZeroPossible()835 public boolean isLeadingZeroPossible() { return leadingZeroPossible_; } setLeadingZeroPossible(boolean value)836 public PhoneMetadata setLeadingZeroPossible(boolean value) { 837 hasLeadingZeroPossible = true; 838 leadingZeroPossible_ = value; 839 return this; 840 } clearLeadingZeroPossible()841 public PhoneMetadata clearLeadingZeroPossible() { 842 hasLeadingZeroPossible = false; 843 leadingZeroPossible_ = false; 844 return this; 845 } 846 847 // optional bool mobile_number_portable_region = 32 [default = false]; 848 private boolean hasMobileNumberPortableRegion; 849 private boolean mobileNumberPortableRegion_ = false; hasMobileNumberPortableRegion()850 public boolean hasMobileNumberPortableRegion() { return hasMobileNumberPortableRegion; } 851 @Deprecated isMobileNumberPortableRegion()852 public boolean isMobileNumberPortableRegion() { return getMobileNumberPortableRegion(); } getMobileNumberPortableRegion()853 public boolean getMobileNumberPortableRegion() { return mobileNumberPortableRegion_; } setMobileNumberPortableRegion(boolean value)854 public PhoneMetadata setMobileNumberPortableRegion(boolean value) { 855 hasMobileNumberPortableRegion = true; 856 mobileNumberPortableRegion_ = value; 857 return this; 858 } clearMobileNumberPortableRegion()859 public PhoneMetadata clearMobileNumberPortableRegion() { 860 hasMobileNumberPortableRegion = false; 861 mobileNumberPortableRegion_ = false; 862 return this; 863 } 864 writeExternal(ObjectOutput objectOutput)865 public void writeExternal(ObjectOutput objectOutput) throws IOException { 866 objectOutput.writeBoolean(hasGeneralDesc); 867 if (hasGeneralDesc) { 868 generalDesc_.writeExternal(objectOutput); 869 } 870 objectOutput.writeBoolean(hasFixedLine); 871 if (hasFixedLine) { 872 fixedLine_.writeExternal(objectOutput); 873 } 874 objectOutput.writeBoolean(hasMobile); 875 if (hasMobile) { 876 mobile_.writeExternal(objectOutput); 877 } 878 objectOutput.writeBoolean(hasTollFree); 879 if (hasTollFree) { 880 tollFree_.writeExternal(objectOutput); 881 } 882 objectOutput.writeBoolean(hasPremiumRate); 883 if (hasPremiumRate) { 884 premiumRate_.writeExternal(objectOutput); 885 } 886 objectOutput.writeBoolean(hasSharedCost); 887 if (hasSharedCost) { 888 sharedCost_.writeExternal(objectOutput); 889 } 890 objectOutput.writeBoolean(hasPersonalNumber); 891 if (hasPersonalNumber) { 892 personalNumber_.writeExternal(objectOutput); 893 } 894 objectOutput.writeBoolean(hasVoip); 895 if (hasVoip) { 896 voip_.writeExternal(objectOutput); 897 } 898 objectOutput.writeBoolean(hasPager); 899 if (hasPager) { 900 pager_.writeExternal(objectOutput); 901 } 902 objectOutput.writeBoolean(hasUan); 903 if (hasUan) { 904 uan_.writeExternal(objectOutput); 905 } 906 objectOutput.writeBoolean(hasEmergency); 907 if (hasEmergency) { 908 emergency_.writeExternal(objectOutput); 909 } 910 objectOutput.writeBoolean(hasVoicemail); 911 if (hasVoicemail) { 912 voicemail_.writeExternal(objectOutput); 913 } 914 objectOutput.writeBoolean(hasShortCode); 915 if (hasShortCode) { 916 shortCode_.writeExternal(objectOutput); 917 } 918 objectOutput.writeBoolean(hasStandardRate); 919 if (hasStandardRate) { 920 standardRate_.writeExternal(objectOutput); 921 } 922 objectOutput.writeBoolean(hasCarrierSpecific); 923 if (hasCarrierSpecific) { 924 carrierSpecific_.writeExternal(objectOutput); 925 } 926 objectOutput.writeBoolean(hasSmsServices); 927 if (hasSmsServices) { 928 smsServices_.writeExternal(objectOutput); 929 } 930 objectOutput.writeBoolean(hasNoInternationalDialling); 931 if (hasNoInternationalDialling) { 932 noInternationalDialling_.writeExternal(objectOutput); 933 } 934 935 objectOutput.writeUTF(id_); 936 objectOutput.writeInt(countryCode_); 937 objectOutput.writeUTF(internationalPrefix_); 938 939 objectOutput.writeBoolean(hasPreferredInternationalPrefix); 940 if (hasPreferredInternationalPrefix) { 941 objectOutput.writeUTF(preferredInternationalPrefix_); 942 } 943 944 objectOutput.writeBoolean(hasNationalPrefix); 945 if (hasNationalPrefix) { 946 objectOutput.writeUTF(nationalPrefix_); 947 } 948 949 objectOutput.writeBoolean(hasPreferredExtnPrefix); 950 if (hasPreferredExtnPrefix) { 951 objectOutput.writeUTF(preferredExtnPrefix_); 952 } 953 954 objectOutput.writeBoolean(hasNationalPrefixForParsing); 955 if (hasNationalPrefixForParsing) { 956 objectOutput.writeUTF(nationalPrefixForParsing_); 957 } 958 959 objectOutput.writeBoolean(hasNationalPrefixTransformRule); 960 if (hasNationalPrefixTransformRule) { 961 objectOutput.writeUTF(nationalPrefixTransformRule_); 962 } 963 964 objectOutput.writeBoolean(sameMobileAndFixedLinePattern_); 965 966 int numberFormatSize = numberFormatSize(); 967 objectOutput.writeInt(numberFormatSize); 968 for (int i = 0; i < numberFormatSize; i++) { 969 numberFormat_.get(i).writeExternal(objectOutput); 970 } 971 972 int intlNumberFormatSize = intlNumberFormatSize(); 973 objectOutput.writeInt(intlNumberFormatSize); 974 for (int i = 0; i < intlNumberFormatSize; i++) { 975 intlNumberFormat_.get(i).writeExternal(objectOutput); 976 } 977 978 objectOutput.writeBoolean(mainCountryForCode_); 979 980 objectOutput.writeBoolean(hasLeadingDigits); 981 if (hasLeadingDigits) { 982 objectOutput.writeUTF(leadingDigits_); 983 } 984 985 objectOutput.writeBoolean(leadingZeroPossible_); 986 987 objectOutput.writeBoolean(mobileNumberPortableRegion_); 988 } 989 readExternal(ObjectInput objectInput)990 public void readExternal(ObjectInput objectInput) throws IOException { 991 boolean hasDesc = objectInput.readBoolean(); 992 if (hasDesc) { 993 PhoneNumberDesc desc = new PhoneNumberDesc(); 994 desc.readExternal(objectInput); 995 setGeneralDesc(desc); 996 } 997 hasDesc = objectInput.readBoolean(); 998 if (hasDesc) { 999 PhoneNumberDesc desc = new PhoneNumberDesc(); 1000 desc.readExternal(objectInput); 1001 setFixedLine(desc); 1002 } 1003 hasDesc = objectInput.readBoolean(); 1004 if (hasDesc) { 1005 PhoneNumberDesc desc = new PhoneNumberDesc(); 1006 desc.readExternal(objectInput); 1007 setMobile(desc); 1008 } 1009 hasDesc = objectInput.readBoolean(); 1010 if (hasDesc) { 1011 PhoneNumberDesc desc = new PhoneNumberDesc(); 1012 desc.readExternal(objectInput); 1013 setTollFree(desc); 1014 } 1015 hasDesc = objectInput.readBoolean(); 1016 if (hasDesc) { 1017 PhoneNumberDesc desc = new PhoneNumberDesc(); 1018 desc.readExternal(objectInput); 1019 setPremiumRate(desc); 1020 } 1021 hasDesc = objectInput.readBoolean(); 1022 if (hasDesc) { 1023 PhoneNumberDesc desc = new PhoneNumberDesc(); 1024 desc.readExternal(objectInput); 1025 setSharedCost(desc); 1026 } 1027 hasDesc = objectInput.readBoolean(); 1028 if (hasDesc) { 1029 PhoneNumberDesc desc = new PhoneNumberDesc(); 1030 desc.readExternal(objectInput); 1031 setPersonalNumber(desc); 1032 } 1033 hasDesc = objectInput.readBoolean(); 1034 if (hasDesc) { 1035 PhoneNumberDesc desc = new PhoneNumberDesc(); 1036 desc.readExternal(objectInput); 1037 setVoip(desc); 1038 } 1039 hasDesc = objectInput.readBoolean(); 1040 if (hasDesc) { 1041 PhoneNumberDesc desc = new PhoneNumberDesc(); 1042 desc.readExternal(objectInput); 1043 setPager(desc); 1044 } 1045 hasDesc = objectInput.readBoolean(); 1046 if (hasDesc) { 1047 PhoneNumberDesc desc = new PhoneNumberDesc(); 1048 desc.readExternal(objectInput); 1049 setUan(desc); 1050 } 1051 hasDesc = objectInput.readBoolean(); 1052 if (hasDesc) { 1053 PhoneNumberDesc desc = new PhoneNumberDesc(); 1054 desc.readExternal(objectInput); 1055 setEmergency(desc); 1056 } 1057 hasDesc = objectInput.readBoolean(); 1058 if (hasDesc) { 1059 PhoneNumberDesc desc = new PhoneNumberDesc(); 1060 desc.readExternal(objectInput); 1061 setVoicemail(desc); 1062 } 1063 hasDesc = objectInput.readBoolean(); 1064 if (hasDesc) { 1065 PhoneNumberDesc desc = new PhoneNumberDesc(); 1066 desc.readExternal(objectInput); 1067 setShortCode(desc); 1068 } 1069 hasDesc = objectInput.readBoolean(); 1070 if (hasDesc) { 1071 PhoneNumberDesc desc = new PhoneNumberDesc(); 1072 desc.readExternal(objectInput); 1073 setStandardRate(desc); 1074 } 1075 hasDesc = objectInput.readBoolean(); 1076 if (hasDesc) { 1077 PhoneNumberDesc desc = new PhoneNumberDesc(); 1078 desc.readExternal(objectInput); 1079 setCarrierSpecific(desc); 1080 } 1081 hasDesc = objectInput.readBoolean(); 1082 if (hasDesc) { 1083 PhoneNumberDesc desc = new PhoneNumberDesc(); 1084 desc.readExternal(objectInput); 1085 setSmsServices(desc); 1086 } 1087 hasDesc = objectInput.readBoolean(); 1088 if (hasDesc) { 1089 PhoneNumberDesc desc = new PhoneNumberDesc(); 1090 desc.readExternal(objectInput); 1091 setNoInternationalDialling(desc); 1092 } 1093 1094 setId(objectInput.readUTF()); 1095 setCountryCode(objectInput.readInt()); 1096 setInternationalPrefix(objectInput.readUTF()); 1097 1098 boolean hasString = objectInput.readBoolean(); 1099 if (hasString) { 1100 setPreferredInternationalPrefix(objectInput.readUTF()); 1101 } 1102 1103 hasString = objectInput.readBoolean(); 1104 if (hasString) { 1105 setNationalPrefix(objectInput.readUTF()); 1106 } 1107 1108 hasString = objectInput.readBoolean(); 1109 if (hasString) { 1110 setPreferredExtnPrefix(objectInput.readUTF()); 1111 } 1112 1113 hasString = objectInput.readBoolean(); 1114 if (hasString) { 1115 setNationalPrefixForParsing(objectInput.readUTF()); 1116 } 1117 1118 hasString = objectInput.readBoolean(); 1119 if (hasString) { 1120 setNationalPrefixTransformRule(objectInput.readUTF()); 1121 } 1122 1123 setSameMobileAndFixedLinePattern(objectInput.readBoolean()); 1124 1125 int nationalFormatSize = objectInput.readInt(); 1126 for (int i = 0; i < nationalFormatSize; i++) { 1127 NumberFormat numFormat = new NumberFormat(); 1128 numFormat.readExternal(objectInput); 1129 numberFormat_.add(numFormat); 1130 } 1131 1132 int intlNumberFormatSize = objectInput.readInt(); 1133 for (int i = 0; i < intlNumberFormatSize; i++) { 1134 NumberFormat numFormat = new NumberFormat(); 1135 numFormat.readExternal(objectInput); 1136 intlNumberFormat_.add(numFormat); 1137 } 1138 1139 setMainCountryForCode(objectInput.readBoolean()); 1140 1141 hasString = objectInput.readBoolean(); 1142 if (hasString) { 1143 setLeadingDigits(objectInput.readUTF()); 1144 } 1145 1146 setLeadingZeroPossible(objectInput.readBoolean()); 1147 1148 setMobileNumberPortableRegion(objectInput.readBoolean()); 1149 } 1150 } 1151 1152 public static class PhoneMetadataCollection implements Externalizable { 1153 private static final long serialVersionUID = 1; PhoneMetadataCollection()1154 public PhoneMetadataCollection() {} 1155 1156 /** 1157 * Provides a dummy builder. 1158 * 1159 * @see NumberFormat.Builder 1160 */ 1161 public static final class Builder extends PhoneMetadataCollection { build()1162 public PhoneMetadataCollection build() { 1163 return this; 1164 } 1165 } newBuilder()1166 public static Builder newBuilder() { 1167 return new Builder(); 1168 } 1169 1170 // repeated PhoneMetadata metadata = 1; 1171 private java.util.List<PhoneMetadata> metadata_ = new java.util.ArrayList<PhoneMetadata>(); 1172 getMetadataList()1173 public java.util.List<PhoneMetadata> getMetadataList() { 1174 return metadata_; 1175 } getMetadataCount()1176 public int getMetadataCount() { return metadata_.size(); } 1177 addMetadata(PhoneMetadata value)1178 public PhoneMetadataCollection addMetadata(PhoneMetadata value) { 1179 if (value == null) { 1180 throw new NullPointerException(); 1181 } 1182 metadata_.add(value); 1183 return this; 1184 } 1185 writeExternal(ObjectOutput objectOutput)1186 public void writeExternal(ObjectOutput objectOutput) throws IOException { 1187 int size = getMetadataCount(); 1188 objectOutput.writeInt(size); 1189 for (int i = 0; i < size; i++) { 1190 metadata_.get(i).writeExternal(objectOutput); 1191 } 1192 } 1193 readExternal(ObjectInput objectInput)1194 public void readExternal(ObjectInput objectInput) throws IOException { 1195 int size = objectInput.readInt(); 1196 for (int i = 0; i < size; i++) { 1197 PhoneMetadata metadata = new PhoneMetadata(); 1198 metadata.readExternal(objectInput); 1199 metadata_.add(metadata); 1200 } 1201 } 1202 clear()1203 public PhoneMetadataCollection clear() { 1204 metadata_.clear(); 1205 return this; 1206 } 1207 } 1208 } 1209