@GET
  @Path(PhoneNumber.VALIDATE)
  public Boolean validate(@QueryParam(Parameters.COUNTRY) final String pcountry,
      @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber,
      @QueryParam(Parameters.DIN_5008) final Boolean pdin5008,
      @QueryParam(Parameters.E123) final Boolean pe123,
      @QueryParam(Parameters.URI) final Boolean puri, @QueryParam(Parameters.MS) final Boolean pms,
      @QueryParam(Parameters.COMMON) final Boolean pcommon) {
    final PhoneNumberData parsedNumber = phoneNumberUtil.parsePhoneNumber(pphoneNumber, pcountry);
    if (parsedNumber.isValid()) {
      if (BooleanUtils.isTrue(pdin5008)
          && (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatDin5008National(parsedNumber))
              || StringUtils.equals(pphoneNumber,
                  phoneNumberUtil.formatDin5008International(parsedNumber)))) {
        return Boolean.TRUE;
      }
      if (BooleanUtils.isTrue(pe123)
          && (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123National(parsedNumber))
              || StringUtils.equals(pphoneNumber,
                  phoneNumberUtil.formatE123International(parsedNumber)))) {
        return Boolean.TRUE;
      }
      if (BooleanUtils.isTrue(puri)
          && StringUtils.equals(pphoneNumber, phoneNumberUtil.formatUrl(parsedNumber))) {
        return Boolean.TRUE;
      }
      if (BooleanUtils.isTrue(pms)
          && StringUtils.equals(pphoneNumber, phoneNumberUtil.formatMs(parsedNumber))) {
        return Boolean.TRUE;
      }
      if (BooleanUtils.isTrue(pcommon)
          && (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatCommonNational(parsedNumber))
              || StringUtils.equals(pphoneNumber,
                  phoneNumberUtil.formatCommonInternational(parsedNumber)))) {
        return Boolean.TRUE;
      }
    }
    return Boolean.FALSE;
  }
@ GET @ Path ( PhoneNumber . VALIDATE ) public Boolean validate ( @ QueryParam ( Parameters . COUNTRY ) final String pcountry , @ QueryParam ( Parameters . PHONE_NUMBER ) final String pphoneNumber , @ QueryParam ( Parameters . DIN_5008 ) final Boolean pdin5008 , @ QueryParam ( Parameters . E123 ) final Boolean pe123 , @ QueryParam ( Parameters . URI ) final Boolean puri , @ QueryParam ( Parameters . MS ) final Boolean pms , @ QueryParam ( Parameters . COMMON ) final Boolean pcommon ) { final PhoneNumberData parsedNumber = phoneNumberUtil . parsePhoneNumber ( pphoneNumber , pcountry ) ; if ( parsedNumber . isValid ( ) ) { if ( BooleanUtils . isTrue ( pdin5008 ) && ( StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatDin5008National ( parsedNumber ) ) || StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatDin5008International ( parsedNumber ) ) ) ) { return Boolean . TRUE ; } if ( BooleanUtils . isTrue ( pe123 ) && ( StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatE123National ( parsedNumber ) ) || StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatE123International ( parsedNumber ) ) ) ) { return Boolean . TRUE ; } if ( BooleanUtils . isTrue ( puri ) && StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatUrl ( parsedNumber ) ) ) { return Boolean . TRUE ; } if ( BooleanUtils . isTrue ( pms ) && StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatMs ( parsedNumber ) ) ) { return Boolean . TRUE ; } if ( BooleanUtils . isTrue ( pcommon ) && ( StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatCommonNational ( parsedNumber ) ) || StringUtils . equals ( pphoneNumber , phoneNumberUtil . formatCommonInternational ( parsedNumber ) ) ) ) { return Boolean . TRUE ; } } return Boolean . FALSE ; }
validate a phone number.

@param pcountry default country
@param pphoneNumber phone number to check
@param pdin5008 set to true if DIN 5008 format is allowed
@param pe123 set to true if E123 format is allowed
@param puri set to true if URI format is allowed
@param pms set to true if Microsoft format is allowed
@param pcommon set to true if common format is allowed
@return true if number is valid