Class PhoneNumTool


  • public class PhoneNumTool
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      PhoneNumTool​(java.lang.String region)
      Phone number tool
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getInternationalNumber​(java.lang.String number)
      Get number in lisible international format
      java.lang.String getNationalNumber​(java.lang.String number)
      Get number in lisible national format
      java.lang.String getNumber​(java.lang.String number)
      Get number normalized format
      java.lang.String getURL​(java.lang.String number)
      Get number in "tel:" URL format
      boolean isValid​(java.lang.String number)
      Check if number is valid
      java.lang.String toJSON​(java.lang.String number)
      Get all number data as JSON string
      org.json.JSONObject toJSONObject​(java.lang.String number)
      Get all number data as JSON object
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PhoneNumTool

        public PhoneNumTool​(java.lang.String region)
                     throws java.lang.Exception
        Phone number tool
        Parameters:
        region - Region for national numbers (null defaults to non geographical region)
        Throws:
        java.lang.Exception
    • Method Detail

      • isValid

        public boolean isValid​(java.lang.String number)
                        throws java.lang.Exception
        Check if number is valid
        Throws:
        java.lang.Exception
      • getNumber

        public java.lang.String getNumber​(java.lang.String number)
                                   throws java.lang.Exception
        Get number normalized format
        Parameters:
        number - Phone number
        Throws:
        java.lang.Exception
      • getURL

        public java.lang.String getURL​(java.lang.String number)
                                throws java.lang.Exception
        Get number in "tel:" URL format
        Parameters:
        number - Phone number
        Throws:
        java.lang.Exception
      • getInternationalNumber

        public java.lang.String getInternationalNumber​(java.lang.String number)
                                                throws java.lang.Exception
        Get number in lisible international format
        Parameters:
        number - Phone number
        Throws:
        java.lang.Exception
      • getNationalNumber

        public java.lang.String getNationalNumber​(java.lang.String number)
                                           throws java.lang.Exception
        Get number in lisible national format
        Parameters:
        number - Phone number
        Throws:
        java.lang.Exception
      • toJSONObject

        public org.json.JSONObject toJSONObject​(java.lang.String number)
                                         throws java.lang.Exception
        Get all number data as JSON object
        Parameters:
        number - Phone number
        Throws:
        java.lang.Exception
      • toJSON

        public java.lang.String toJSON​(java.lang.String number)
                                throws java.lang.Exception
        Get all number data as JSON string
        Parameters:
        number - Phone number
        Throws:
        java.lang.Exception