Package com.storedobject.common
Class PhoneNumber
java.lang.Object
com.storedobject.common.PhoneNumber
Class used to check phone number validity.
A valid phone number starts with a "+" symbol followed by dialing digits with optional space separators. The first one or more digits following the "+" symbol should match with ISD code of one of the countries (see
A valid phone number starts with a "+" symbol followed by dialing digits with optional space separators. The first one or more digits following the "+" symbol should match with ISD code of one of the countries (see
Country.getISDCode()
).- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Check correctness of the format of the given phone number.static String
Check correctness of the format of the given phone number.static Country
getCountry
(String phoneNumber) Get the country for the given phone number.
-
Constructor Details
-
PhoneNumber
public PhoneNumber()
-
-
Method Details
-
check
Check correctness of the format of the given phone number.- Parameters:
phoneNumber
- Phone number- Returns:
- Phone number (may be modified).
- Throws:
SOException
- If the phone number format is not valid
-
check
Check correctness of the format of the given phone number.- Parameters:
phoneNumber
- Phone numberallowEmpty
- Whether empty should be taken as valid or not- Returns:
- Phone number (maybe modified).
- Throws:
SOException
- If the phone number format is not valid
-
getCountry
-