Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.plugin.addrbook
Class PhoneNumberI18nServiceImpl

java.lang.Object
  extended by net.java.sip.communicator.plugin.addrbook.PhoneNumberI18nServiceImpl
All Implemented Interfaces:
PhoneNumberI18nService

public class PhoneNumberI18nServiceImpl
extends Object
implements PhoneNumberI18nService

Implements PhoneNumberI18nService which aids the parsing, formatting and validating of international phone numbers using the libphonenumber library.

Author:
Lyubomir Marinov

Constructor Summary
PhoneNumberI18nServiceImpl()
           
 
Method Summary
 boolean isPhoneNumber(String possibleNumber)
          Indicates if the given string is possibly a phone number.
 String normalize(String phoneNumber)
          Normalizes a String phone number by converting alpha characters to their respective digits on a keypad and then stripping non-digit characters.
 boolean phoneNumbersMatch(String aPhoneNumber, String bPhoneNumber)
          Determines whether two String phone numbers match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhoneNumberI18nServiceImpl

public PhoneNumberI18nServiceImpl()
Method Detail

normalize

public String normalize(String phoneNumber)
Normalizes a String phone number by converting alpha characters to their respective digits on a keypad and then stripping non-digit characters.

Specified by:
normalize in interface PhoneNumberI18nService
Parameters:
phoneNumber - a String which represents a phone number to normalize
Returns:
a String which is a normalized form of the specified phoneNumber
See Also:
PhoneNumberI18nService.normalize(String)

phoneNumbersMatch

public boolean phoneNumbersMatch(String aPhoneNumber,
                                 String bPhoneNumber)
Determines whether two String phone numbers match.

Specified by:
phoneNumbersMatch in interface PhoneNumberI18nService
Parameters:
aPhoneNumber - a String which represents a phone number to match to bPhoneNumber
bPhoneNumber - a String which represents a phone number to match to aPhoneNumber
Returns:
true if the specified Strings match as phone numbers; otherwise, false

isPhoneNumber

public boolean isPhoneNumber(String possibleNumber)
Indicates if the given string is possibly a phone number.

Specified by:
isPhoneNumber in interface PhoneNumberI18nService
Parameters:
possibleNumber - the string to be verified
Returns:
true if the possibleNumber is a phone number, false - otherwise

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.