@GET @Path(PhoneNumber.FORMAT_E123_NATIONAL) public String formatE123National(@QueryParam(Parameters.LANGUAGE) final String planguage, @QueryParam(Parameters.COUNTRY) final String pcountry, @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber) { return phoneNumberUtil.formatE123National(pphoneNumber, pcountry); }
/** * format phone number in E123 national format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatE123National(final String pphoneNumber) { return this.formatE123National(this.parsePhoneNumber(pphoneNumber)); }
@RequestMapping(value = PhoneNumber.FORMAT_E123_NATIONAL, method = RequestMethod.GET) @PermitAll public String formatE123National( @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.formatE123National(pphoneNumber, pcountry); }
@RequestMapping(value = PhoneNumber.FORMAT_E123_NATIONAL, method = RequestMethod.GET) @PermitAll public String formatE123National( @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.formatE123National(pphoneNumber, pcountry); }
/** * format phone number in E123 national format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatE123National(final String pphoneNumber, final String pcountryCode) { return this.formatE123National(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
/** * format phone number in E123 national format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatE123National(final String pphoneNumber) { return this.formatE123National(this.parsePhoneNumber(pphoneNumber)); }
/** * format phone number in E123 national format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatE123National(final String pphoneNumber, final String pcountryCode) { return this.formatE123National(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
/** * format phone number in E123 format. * * @param pphoneNumberData phone number to format * @param pcountryData country data * @return formated phone number as String */ public final String formatE123(final PhoneNumberInterface pphoneNumberData, final PhoneCountryData pcountryData) { if (pphoneNumberData != null && pcountryData != null && StringUtils.equals( pcountryData.getCountryCodeData().getCountryCode(), pphoneNumberData.getCountryCode())) { return this.formatE123National(pphoneNumberData); } else { return this.formatE123International(pphoneNumberData); } }
/** * format phone number in E123 format. * * @param pphoneNumberData phone number to format * @param pcountryData country data * @return formated phone number as String */ public final String formatE123(final PhoneNumberInterface pphoneNumberData, final PhoneCountryData pcountryData) { if (pphoneNumberData != null && pcountryData != null && StringUtils.equals( pcountryData.getCountryCodeData().getCountryCode(), pphoneNumberData.getCountryCode())) { return this.formatE123National(pphoneNumberData); } else { return this.formatE123International(pphoneNumberData); } }
/** * test formating phone number in E123 national format. */ @Test public void testFormatE123National() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123National((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatE123NationalCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatE123National(testCase.getKey()); Assert.assertEquals("Formating E123 national " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in E123 national format. */ @Test public void testFormatE123National() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123National((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatE123NationalCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatE123National(testCase.getKey()); Assert.assertEquals("Formating E123 national " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
&& (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123National(parsedNumber)) || StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123International(parsedNumber)))) {
&& (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123National(parsedNumber)) || StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123International(parsedNumber)))) {
/** * test formating phone number in E123 national format with cursor position. */ @Test public void testFormatE123NationalWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123National((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatE123NationalPosCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatE123National(testCase.getKey()); Assert.assertEquals("Formating E123 national " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
&& (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123National(parsedNumber)) || StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123International(parsedNumber)))) {
/** * test formating phone number in E123 national format with cursor position. */ @Test public void testFormatE123NationalWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123National((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatE123NationalPosCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatE123National(testCase.getKey()); Assert.assertEquals("Formating E123 national " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
this.phoneNumberUtil.formatE123National(parsedNumber)) || StringUtils.equals(phoneNumber, this.phoneNumberUtil.formatE123International(parsedNumber)))) {
/** * parse and reformat the phone number in all available formats. * * @param planguage language to use * @param pcountry default country * @param pphoneNumber phone number to format * @return PhoneNumberDataWithFormats */ @GET @Path(PhoneNumber.PARSE_AND_FORMAT) public PhoneNumberDataWithFormats parseAndFormatPhoneNumber( @QueryParam(Parameters.LANGUAGE) final String planguage, @QueryParam(Parameters.COUNTRY) final String pcountry, @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber) { final PhoneNumberDataWithFormats result = new PhoneNumberDataWithFormats(phoneNumberUtil .parsePhoneNumber(pphoneNumber, pcountry, LocaleUtil.convertLanguageToLocale(planguage))); result.setCommonInternational(phoneNumberUtil.formatCommonInternational(result)); result.setCommonNational(phoneNumberUtil.formatCommonNational(result)); result.setDin5008International(phoneNumberUtil.formatDin5008International(result)); result.setDin5008National(phoneNumberUtil.formatDin5008National(result)); result.setE123International(phoneNumberUtil.formatE123International(result)); result.setE123National(phoneNumberUtil.formatE123National(result)); result.setMs(phoneNumberUtil.formatMs(result)); result.setUrl(phoneNumberUtil.formatUrl(result)); return result; }
/** * parse and reformat the phone number in all available formats. * * @param planguage language to use * @param pcountry default country * @param pphoneNumber phone number to format * @return PhoneNumberDataWithFormats */ @RequestMapping(value = PhoneNumber.PARSE_AND_FORMAT, method = RequestMethod.GET) @PermitAll public PhoneNumberDataWithFormats parseAndFormatPhoneNumber( @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) { final PhoneNumberDataWithFormats result = new PhoneNumberDataWithFormats(phoneNumberUtil .parsePhoneNumber(pphoneNumber, pcountry, LocaleUtil.convertLanguageToLocale(planguage))); result.setCommonInternational(phoneNumberUtil.formatCommonInternational(result)); result.setCommonNational(phoneNumberUtil.formatCommonNational(result)); result.setDin5008International(phoneNumberUtil.formatDin5008International(result)); result.setDin5008National(phoneNumberUtil.formatDin5008National(result)); result.setE123International(phoneNumberUtil.formatE123International(result)); result.setE123National(phoneNumberUtil.formatE123National(result)); result.setMs(phoneNumberUtil.formatMs(result)); result.setUrl(phoneNumberUtil.formatUrl(result)); return result; }
/** * parse and reformat the phone number in all available formats. * * @param planguage language to use * @param pcountry default country * @param pphoneNumber phone number to format * @return PhoneNumberDataWithFormats */ @RequestMapping(value = PhoneNumber.PARSE_AND_FORMAT, method = RequestMethod.GET) @PermitAll public PhoneNumberDataWithFormats parseAndFormatPhoneNumber( @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) { final PhoneNumberDataWithFormats result = new PhoneNumberDataWithFormats(phoneNumberUtil .parsePhoneNumber(pphoneNumber, pcountry, LocaleUtil.convertLanguageToLocale(planguage))); result.setCommonInternational(phoneNumberUtil.formatCommonInternational(result)); result.setCommonNational(phoneNumberUtil.formatCommonNational(result)); result.setDin5008International(phoneNumberUtil.formatDin5008International(result)); result.setDin5008National(phoneNumberUtil.formatDin5008National(result)); result.setE123International(phoneNumberUtil.formatE123International(result)); result.setE123National(phoneNumberUtil.formatE123National(result)); result.setMs(phoneNumberUtil.formatMs(result)); result.setUrl(phoneNumberUtil.formatUrl(result)); return result; }