Package com.google.type
Class PhoneNumber
java.lang.Object
com.google.protobuf.AbstractMessageLite<MessageType,BuilderType>
com.google.protobuf.GeneratedMessageLite<PhoneNumber,PhoneNumber.Builder>
com.google.type.PhoneNumber
- All Implemented Interfaces:
com.google.protobuf.MessageLite
,com.google.protobuf.MessageLiteOrBuilder
,PhoneNumberOrBuilder
public final class PhoneNumber
extends com.google.protobuf.GeneratedMessageLite<PhoneNumber,PhoneNumber.Builder>
implements PhoneNumberOrBuilder
An object representing a phone number, suitable as an API wire format. This representation: - should not be used for locale-specific formatting of a phone number, such as "+1 (650) 253-0000 ext. 123" - is not designed for efficient storage - may not be suitable for dialing - specialized libraries (see references) should be used to parse the number for that purpose To do something meaningful with this number, such as format it for various use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first. For instance, in Java this would be: com.google.type.PhoneNumber wireProto = com.google.type.PhoneNumber.newBuilder().build(); com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber = PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ"); if (!wireProto.getExtension().isEmpty()) { phoneNumber.setExtension(wireProto.getExtension()); } Reference(s): - https://github.com/google/libphonenumberProtobuf type
google.type.PhoneNumber
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
An object representing a phone number, suitable as an API wire format.static enum
static final class
An object representing a short code, which is a phone number that is typically much shorter than regular phone numbers and can be used to address messages in MMS and SMS systems, as well as for abbreviated dialing (e.g.static interface
Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageLite
com.google.protobuf.GeneratedMessageLite.DefaultInstanceBasedParser<T extends com.google.protobuf.GeneratedMessageLite<T,
?>>, com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.GeneratedExtension<ContainingType extends com.google.protobuf.MessageLite, Type extends Object>, com.google.protobuf.GeneratedMessageLite.MethodToInvoke, com.google.protobuf.GeneratedMessageLite.SerializedForm Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
Fields inherited from class com.google.protobuf.GeneratedMessageLite
unknownFields
Fields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode
-
Method Summary
Modifier and TypeMethodDescriptionprotected final Object
dynamicMethod
(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) static PhoneNumber
The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123".com.google.protobuf.ByteString
The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123".The phone number's extension.com.google.protobuf.ByteString
The phone number's extension.A short code.boolean
The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123".boolean
A short code.static PhoneNumber.Builder
static PhoneNumber.Builder
newBuilder
(PhoneNumber prototype) static PhoneNumber
parseDelimitedFrom
(InputStream input) static PhoneNumber
parseDelimitedFrom
(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static PhoneNumber
parseFrom
(byte[] data) static PhoneNumber
parseFrom
(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static PhoneNumber
parseFrom
(com.google.protobuf.ByteString data) static PhoneNumber
parseFrom
(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static PhoneNumber
parseFrom
(com.google.protobuf.CodedInputStream input) static PhoneNumber
parseFrom
(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static PhoneNumber
parseFrom
(InputStream input) static PhoneNumber
parseFrom
(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static PhoneNumber
parseFrom
(ByteBuffer data) static PhoneNumber
parseFrom
(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static com.google.protobuf.Parser<PhoneNumber>
parser()
Methods inherited from class com.google.protobuf.GeneratedMessageLite
createBuilder, createBuilder, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, getSerializedSize, hashCode, isInitialized, isInitialized, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newMessageInfo, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, registerDefaultInstance, toBuilder, toString, writeTo
Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Field Details
-
E164_NUMBER_FIELD_NUMBER
public static final int E164_NUMBER_FIELD_NUMBER- See Also:
-
SHORT_CODE_FIELD_NUMBER
public static final int SHORT_CODE_FIELD_NUMBER- See Also:
-
EXTENSION_FIELD_NUMBER
public static final int EXTENSION_FIELD_NUMBER- See Also:
-
-
Method Details
-
getKindCase
- Specified by:
getKindCase
in interfacePhoneNumberOrBuilder
-
hasE164Number
public boolean hasE164Number()The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123". The ITU E.164 format limits the latter to 12 digits, but in practice not all countries respect that, so we relax that restriction here. National-only numbers are not allowed. References: - https://www.itu.int/rec/T-REC-E.164-201011-I - https://en.wikipedia.org/wiki/E.164. - https://en.wikipedia.org/wiki/List_of_country_calling_codes
string e164_number = 1 [json_name = "e164Number"];
- Specified by:
hasE164Number
in interfacePhoneNumberOrBuilder
- Returns:
- Whether the e164Number field is set.
-
getE164Number
The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123". The ITU E.164 format limits the latter to 12 digits, but in practice not all countries respect that, so we relax that restriction here. National-only numbers are not allowed. References: - https://www.itu.int/rec/T-REC-E.164-201011-I - https://en.wikipedia.org/wiki/E.164. - https://en.wikipedia.org/wiki/List_of_country_calling_codes
string e164_number = 1 [json_name = "e164Number"];
- Specified by:
getE164Number
in interfacePhoneNumberOrBuilder
- Returns:
- The e164Number.
-
getE164NumberBytes
public com.google.protobuf.ByteString getE164NumberBytes()The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123". The ITU E.164 format limits the latter to 12 digits, but in practice not all countries respect that, so we relax that restriction here. National-only numbers are not allowed. References: - https://www.itu.int/rec/T-REC-E.164-201011-I - https://en.wikipedia.org/wiki/E.164. - https://en.wikipedia.org/wiki/List_of_country_calling_codes
string e164_number = 1 [json_name = "e164Number"];
- Specified by:
getE164NumberBytes
in interfacePhoneNumberOrBuilder
- Returns:
- The bytes for e164Number.
-
hasShortCode
public boolean hasShortCode()A short code. Reference(s): - https://en.wikipedia.org/wiki/Short_code
.google.type.PhoneNumber.ShortCode short_code = 2 [json_name = "shortCode"];
- Specified by:
hasShortCode
in interfacePhoneNumberOrBuilder
- Returns:
- Whether the shortCode field is set.
-
getShortCode
A short code. Reference(s): - https://en.wikipedia.org/wiki/Short_code
.google.type.PhoneNumber.ShortCode short_code = 2 [json_name = "shortCode"];
- Specified by:
getShortCode
in interfacePhoneNumberOrBuilder
- Returns:
- The shortCode.
-
getExtension
The phone number's extension. The extension is not standardized in ITU recommendations, except for being defined as a series of numbers with a maximum length of 40 digits. Other than digits, some other dialing characters such as ',' (indicating a wait) or '#' may be stored here. Note that no regions currently use extensions with short codes, so this field is normally only set in conjunction with an E.164 number. It is held separately from the E.164 number to allow for short code extensions in the future.
string extension = 3 [json_name = "extension"];
- Specified by:
getExtension
in interfacePhoneNumberOrBuilder
- Returns:
- The extension.
-
getExtensionBytes
public com.google.protobuf.ByteString getExtensionBytes()The phone number's extension. The extension is not standardized in ITU recommendations, except for being defined as a series of numbers with a maximum length of 40 digits. Other than digits, some other dialing characters such as ',' (indicating a wait) or '#' may be stored here. Note that no regions currently use extensions with short codes, so this field is normally only set in conjunction with an E.164 number. It is held separately from the E.164 number to allow for short code extensions in the future.
string extension = 3 [json_name = "extension"];
- Specified by:
getExtensionBytes
in interfacePhoneNumberOrBuilder
- Returns:
- The bytes for extension.
-
parseFrom
public static PhoneNumber parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static PhoneNumber parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static PhoneNumber parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static PhoneNumber parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static PhoneNumber parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static PhoneNumber parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static PhoneNumber parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
- Throws:
IOException
-
parseDelimitedFrom
public static PhoneNumber parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static PhoneNumber parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilder
-
newBuilder
-
dynamicMethod
protected final Object dynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) - Specified by:
dynamicMethod
in classcom.google.protobuf.GeneratedMessageLite<PhoneNumber,
PhoneNumber.Builder>
-
getDefaultInstance
-
parser
-