/** * format phone number in common format. * * @param pphoneNumberData phone number to format * @return formated phone number as String */ public final String formatCommon(final PhoneNumberInterface pphoneNumberData) { return this.formatCommon(pphoneNumberData, defaultCountryData); }
/** * format phone number in common format. * * @param pphoneNumberData phone number to format * @return formated phone number as String */ public final String formatCommon(final PhoneNumberInterface pphoneNumberData) { return this.formatCommon(pphoneNumberData, defaultCountryData); }
@GET @Path(PhoneNumber.FORMAT_COMMON) public String formatCommon(@QueryParam(Parameters.LANGUAGE) final String planguage, @QueryParam(Parameters.COUNTRY) final String pcountry, @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber) { return phoneNumberUtil.formatCommon(pphoneNumber, pcountry); }
@RequestMapping(value = PhoneNumber.FORMAT_COMMON, method = RequestMethod.GET) @PermitAll public String formatCommon( @RequestParam(value = Parameters.LANGUAGE, required = true) final String planguage, @RequestParam(value = Parameters.COUNTRY, required = true) final String pcountry, @RequestParam(value = Parameters.PHONE_NUMBER, required = true) final String pphoneNumber) { return phoneNumberUtil.formatCommon(pphoneNumber, pcountry); }
/** * format phone number in Common format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatCommon(final String pphoneNumber) { return this.formatCommon(this.parsePhoneNumber(pphoneNumber)); }
@RequestMapping(value = PhoneNumber.FORMAT_COMMON, method = RequestMethod.GET) @PermitAll public String formatCommon( @RequestParam(value = Parameters.LANGUAGE, required = true) final String planguage, @RequestParam(value = Parameters.COUNTRY, required = true) final String pcountry, @RequestParam(value = Parameters.PHONE_NUMBER, required = true) final String pphoneNumber) { return phoneNumberUtil.formatCommon(pphoneNumber, pcountry); }
/** * format phone number in Common format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatCommon(final String pphoneNumber) { return this.formatCommon(this.parsePhoneNumber(pphoneNumber)); }
@Override public String formatValueSynchron(final String pvalue) { final String formatedNumber = phoneNumberUtil.formatCommon(pvalue, StringUtils.upperCase(Objects.toString(countryCodeField.getValue(), null))); if (StringUtils.startsWith(pvalue, formatedNumber)) { return pvalue; } return StringUtils.defaultString(formatedNumber, pvalue); }
/** * format phone number in common format. * * @param pphoneNumberData phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatCommon(final PhoneNumberInterface pphoneNumberData, final String pcountryCode) { return this.formatCommon(pphoneNumberData, CreatePhoneCountryConstantsClass.create() .countryMap().get(StringUtils.defaultString(pcountryCode))); }
/** * format phone number in common format. * * @param pphoneNumberData phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatCommon(final PhoneNumberInterface pphoneNumberData, final String pcountryCode) { return this.formatCommon(pphoneNumberData, CreatePhoneCountryConstantsClass.create() .countryMap().get(StringUtils.defaultString(pcountryCode))); }
/** * format phone number in common format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatCommon(final String pphoneNumber, final String pcountryCode) { return this.formatCommon(this.parsePhoneNumber(pphoneNumber, pcountryCode), CreatePhoneCountryConstantsClass.create().countryMap() .get(StringUtils.defaultString(pcountryCode))); }
/** * format phone number in common format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatCommon(final String pphoneNumber, final String pcountryCode) { return this.formatCommon(this.parsePhoneNumber(pphoneNumber, pcountryCode), CreatePhoneCountryConstantsClass.create().countryMap() .get(StringUtils.defaultString(pcountryCode))); }
/** * test formating phone number in common format. */ @Test public void testFormatCommon() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatCommon((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatCommonCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatCommon(testCase.getKey()); Assert.assertEquals("Formating common " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in common format. */ @Test public void testFormatCommon() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatCommon((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatCommonCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatCommon(testCase.getKey()); Assert.assertEquals("Formating common " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in common format with cursor position. */ @Test public void testFormatCommonWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatCommon((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatCommonWithPosCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatCommon(testCase.getKey()); Assert.assertEquals("Formating Common " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in common format with cursor position. */ @Test public void testFormatCommonWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatCommon((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatCommonWithPosCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatCommon(testCase.getKey()); Assert.assertEquals("Formating Common " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }