Package com.google.i18n.phonenumbers
Class PhoneNumberToTimeZonesMapper
- java.lang.Object
-
- com.google.i18n.phonenumbers.PhoneNumberToTimeZonesMapper
-
public class PhoneNumberToTimeZonesMapper extends java.lang.ObjectAn offline mapper from phone numbers to time zones.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PhoneNumberToTimeZonesMappergetInstance()Gets aPhoneNumberToTimeZonesMapperinstance.java.util.List<java.lang.String>getTimeZonesForGeographicalNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber number)Returns a list of time zones to which a phone number belongs.java.util.List<java.lang.String>getTimeZonesForNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber number)As pergetTimeZonesForGeographicalNumber(PhoneNumber)but explicitly checks the validity of the number passed in.static java.lang.StringgetUnknownTimeZone()Returns a String with the ICU unknown time zone.
-
-
-
Method Detail
-
getInstance
public static PhoneNumberToTimeZonesMapper getInstance()
Gets aPhoneNumberToTimeZonesMapperinstance.The
PhoneNumberToTimeZonesMapperis implemented as a singleton. Therefore, calling this method multiple times will only result in one instance being created.- Returns:
- a
PhoneNumberToTimeZonesMapperinstance
-
getTimeZonesForGeographicalNumber
public java.util.List<java.lang.String> getTimeZonesForGeographicalNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber number)
Returns a list of time zones to which a phone number belongs.This method assumes the validity of the number passed in has already been checked, and that the number is geo-localizable. We consider fixed-line and mobile numbers possible candidates for geo-localization.
- Parameters:
number- a valid phone number for which we want to get the time zones to which it belongs- Returns:
- a list of the corresponding time zones or a single element list with the default unknown time zone if no other time zone was found or if the number was invalid
-
getTimeZonesForNumber
public java.util.List<java.lang.String> getTimeZonesForNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber number)
As pergetTimeZonesForGeographicalNumber(PhoneNumber)but explicitly checks the validity of the number passed in.- Parameters:
number- the phone number for which we want to get the time zones to which it belongs- Returns:
- a list of the corresponding time zones or a single element list with the default unknown time zone if no other time zone was found or if the number was invalid
-
getUnknownTimeZone
public static java.lang.String getUnknownTimeZone()
Returns a String with the ICU unknown time zone.
-
-