org.kuali.kfs.vnd.service.impl
Class PhoneNumberServiceImpl
java.lang.Object
org.kuali.kfs.vnd.service.impl.PhoneNumberServiceImpl
- All Implemented Interfaces:
- PhoneNumberService
public class PhoneNumberServiceImpl
- extends Object
- implements PhoneNumberService
Method Summary |
String |
formatNumberIfPossible(String unformattedNumber)
Converts a valid phone number to the default format. |
boolean |
isDefaultFormatPhoneNumber(String phone)
A predicate to determine whether the given phone number is in the default format. |
boolean |
isValidPhoneNumber(String phone)
A predicate to determine the validity of phone numbers, using only the formats which are common in North America (which we
are calling Generic formats) as examples. |
protected String[] |
parseFormats()
Splits the set of phone number formats which are returned from the rule service as a semicolon-delimeted String into a String
array. |
void |
setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parameterService
public org.kuali.rice.kns.service.ParameterService parameterService
phoneNumberFormats
public List<String> phoneNumberFormats
PHONE_FORMAT_RULE_DEFAULT_INDEX
public final int PHONE_FORMAT_RULE_DEFAULT_INDEX
- See Also:
- Constant Field Values
PhoneNumberServiceImpl
public PhoneNumberServiceImpl()
setParameterService
public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
formatNumberIfPossible
public String formatNumberIfPossible(String unformattedNumber)
- Converts a valid phone number to the default format. Must be changed if the generic format changes. The string passed in is
stripped of non-number chars. If it is then the right length it is formatted. If not the right length the original string is
returned.
- Specified by:
formatNumberIfPossible
in interface PhoneNumberService
- Parameters:
phone
- The phone number String to be converted
- Returns:
- A String in the default valid format
- See Also:
PhoneNumberFormatter
isValidPhoneNumber
public boolean isValidPhoneNumber(String phone)
- A predicate to determine the validity of phone numbers, using only the formats which are common in North America (which we
are calling Generic formats) as examples.
- Specified by:
isValidPhoneNumber
in interface PhoneNumberService
- Parameters:
phone
- A phone number String
- Returns:
- True if the phone number is known to be in a valid format
parseFormats
protected String[] parseFormats()
- Splits the set of phone number formats which are returned from the rule service as a semicolon-delimeted String into a String
array.
- Returns:
- A String array of the phone number format regular expressions.
isDefaultFormatPhoneNumber
public boolean isDefaultFormatPhoneNumber(String phone)
- A predicate to determine whether the given phone number is in the default format.
- Specified by:
isDefaultFormatPhoneNumber
in interface PhoneNumberService
- Parameters:
phone
- A phone number String
- Returns:
- True if the phone number is in the default format.
Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.