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