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.
Nested types
Section titled “Nested types”| Type | Returned by | Documentation |
|---|---|---|
NF.Match | NF.findNumbers, NF.finder | Text & typing |
NF.Finder | NF.finder | Text & typing |
NF.AsYouType | NF.asYouType | Text & typing |
NF.MutableText | NF.formatInto and related | Formatting |
NF.Metadata | NF.metadataForRegion | Metadata |
NF.PhoneDesc | metadata getters | Metadata |
NF.NumberFormatRule | metadata format rules | Metadata |
NF.Format
Section titled “NF.Format”Output format for NF.format and related methods.
| Value | Typical use |
|---|---|
E164 | Storage and APIs: +16502530000 |
INTERNATIONAL | Display with country code: +1 650-253-0000 |
NATIONAL | Local display: (650) 253-0000 |
RFC3966 | tel: URI: tel:+1-650-253-0000 |
libphonenumber: PhoneNumberUtil.PhoneNumberFormat
NF.NumberType
Section titled “NF.NumberType”Line type from NF.typeOf.
| Value | Meaning |
|---|---|
FIXED_LINE | Landline |
MOBILE | Mobile |
FIXED_LINE_OR_MOBILE | Region does not distinguish fixed vs mobile |
TOLL_FREE | Toll-free |
PREMIUM_RATE | Premium rate |
SHARED_COST | Shared cost |
VOIP | VoIP |
PERSONAL_NUMBER | Personal number |
PAGER | Pager |
UAN | Universal access number |
VOICEMAIL | Voicemail access |
UNKNOWN | Unknown type |
libphonenumber: PhoneNumberUtil.PhoneNumberType
NF.ValidationResult
Section titled “NF.ValidationResult”Reason from NF.possibleReason.
| Value | Meaning |
|---|---|
IS_POSSIBLE | Length and structure are plausible |
IS_POSSIBLE_LOCAL_ONLY | Possible only as a local number |
INVALID_COUNTRY_CODE | Country code is invalid |
TOO_SHORT | Too few digits |
INVALID_LENGTH | Length invalid for region |
TOO_LONG | Too many digits |
libphonenumber: PhoneNumberUtil.ValidationResult
NF.MatchType
Section titled “NF.MatchType”Result from NF.isNumberMatch.
| Value | Meaning |
|---|---|
EXACT_MATCH | Same number, including extension |
NSN_MATCH | Same national significant number |
SHORT_NSN_MATCH | Short NSN match |
NO_MATCH | Different numbers |
NOT_A_NUMBER | One side is not a number |
libphonenumber: PhoneNumberUtil.MatchType
NF.Leniency
Section titled “NF.Leniency”Strictness for NF.findNumbers.
| Value | Meaning |
|---|---|
POSSIBLE | Loosest; possible lengths only |
VALID | Valid numbers only (common default) |
STRICT_GROUPING | Stricter punctuation rules |
EXACT_GROUPING | Strictest grouping |
libphonenumber: PhoneNumberMatcher.Leniency
NF.CountryCodeSource
Section titled “NF.CountryCodeSource”How the country code was chosen when using NF.parseAndKeepRawInput.
| Value | Meaning |
|---|---|
FROM_NUMBER_WITH_PLUS_SIGN | Leading + in input |
FROM_NUMBER_WITH_IDD | International direct dial prefix |
FROM_NUMBER_WITHOUT_PLUS_SIGN | Country code without + |
FROM_DEFAULT_COUNTRY | Inferred from default region |
UNSPECIFIED | Not set |
libphonenumber: Phonenumber.PhoneNumber.CountryCodeSource
NF.ShortNumberCost
Section titled “NF.ShortNumberCost”Expected cost from NF.expectedShortNumberCost and related Short numbers APIs.
| Value | Meaning |
|---|---|
TOLL_FREE | Toll-free short code |
STANDARD_RATE | Standard rate |
PREMIUM_RATE | Premium rate |
UNKNOWN_COST | Unknown |
libphonenumber: ShortNumberInfo.ShortNumberCost
NF.ParseException
Section titled “NF.ParseException”Thrown when NF.parse (and related parsing methods) cannot parse input.
global class ParseException extends Exception {}libphonenumber: NumberParseException