Skip to content

Types

Enums and exceptions used across the API. Nested classes returned by NF static methods are summarized below; instance methods are documented on their topic pages.

TypeReturned byDocumentation
NF.MatchNF.findNumbers, NF.finderText & typing
NF.FinderNF.finderText & typing
NF.AsYouTypeNF.asYouTypeText & typing
NF.MutableTextNF.formatInto and relatedFormatting
NF.MetadataNF.metadataForRegionMetadata
NF.PhoneDescmetadata gettersMetadata
NF.NumberFormatRulemetadata format rulesMetadata

Output format for NF.format and related methods.

ValueTypical use
E164Storage and APIs: +16502530000
INTERNATIONALDisplay with country code: +1 650-253-0000
NATIONALLocal display: (650) 253-0000
RFC3966tel: URI: tel:+1-650-253-0000

libphonenumber: PhoneNumberUtil.PhoneNumberFormat


Line type from NF.typeOf.

ValueMeaning
FIXED_LINELandline
MOBILEMobile
FIXED_LINE_OR_MOBILERegion does not distinguish fixed vs mobile
TOLL_FREEToll-free
PREMIUM_RATEPremium rate
SHARED_COSTShared cost
VOIPVoIP
PERSONAL_NUMBERPersonal number
PAGERPager
UANUniversal access number
VOICEMAILVoicemail access
UNKNOWNUnknown type

libphonenumber: PhoneNumberUtil.PhoneNumberType


Reason from NF.possibleReason.

ValueMeaning
IS_POSSIBLELength and structure are plausible
IS_POSSIBLE_LOCAL_ONLYPossible only as a local number
INVALID_COUNTRY_CODECountry code is invalid
TOO_SHORTToo few digits
INVALID_LENGTHLength invalid for region
TOO_LONGToo many digits

libphonenumber: PhoneNumberUtil.ValidationResult


Result from NF.isNumberMatch.

ValueMeaning
EXACT_MATCHSame number, including extension
NSN_MATCHSame national significant number
SHORT_NSN_MATCHShort NSN match
NO_MATCHDifferent numbers
NOT_A_NUMBEROne side is not a number

libphonenumber: PhoneNumberUtil.MatchType


Strictness for NF.findNumbers.

ValueMeaning
POSSIBLELoosest; possible lengths only
VALIDValid numbers only (common default)
STRICT_GROUPINGStricter punctuation rules
EXACT_GROUPINGStrictest grouping

libphonenumber: PhoneNumberMatcher.Leniency


How the country code was chosen when using NF.parseAndKeepRawInput.

ValueMeaning
FROM_NUMBER_WITH_PLUS_SIGNLeading + in input
FROM_NUMBER_WITH_IDDInternational direct dial prefix
FROM_NUMBER_WITHOUT_PLUS_SIGNCountry code without +
FROM_DEFAULT_COUNTRYInferred from default region
UNSPECIFIEDNot set

libphonenumber: Phonenumber.PhoneNumber.CountryCodeSource


Expected cost from NF.expectedShortNumberCost and related Short numbers APIs.

ValueMeaning
TOLL_FREEToll-free short code
STANDARD_RATEStandard rate
PREMIUM_RATEPremium rate
UNKNOWN_COSTUnknown

libphonenumber: ShortNumberInfo.ShortNumberCost


Thrown when NF.parse (and related parsing methods) cannot parse input.

global class ParseException extends Exception {}

libphonenumber: NumberParseException