Class TelephoneNumberSyntaxChecker

  • All Implemented Interfaces:
    Serializable, SchemaObject

    public final class TelephoneNumberSyntaxChecker
    extends SyntaxChecker
    A SyntaxChecker which verifies that a value is a TelephoneNumber according to ITU recommendation E.123 (which is quite vague ...).

    A valid Telephone number respects more or less this syntax :

     " *[+]? *((\([0-9- ,;/#*]+\))|[0-9- ,;/#*]+)+"
     
    If needed, and to allow more syntaxes, a list of regexps has been added which can be initialized to other values
    Author:
    Apache Directory Project
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_REGEXP

        private static final String DEFAULT_REGEXP
        The default pattern used to check a TelephoneNumber
        See Also:
        Constant Field Values
      • defaultRegexp

        private final String defaultRegexp
        The default pattern
      • defaultPattern

        private final Pattern defaultPattern
        The compiled default pattern
    • Constructor Detail

      • TelephoneNumberSyntaxChecker

        private TelephoneNumberSyntaxChecker​(String oid)
        Creates a new instance of a child of this class, with an OID.
        Parameters:
        oid - the child's OID
      • TelephoneNumberSyntaxChecker

        private TelephoneNumberSyntaxChecker​(String oid,
                                             String defaultRegexp,
                                             Pattern defaultPattern)
        Creates a new instance of a child of this class, with an OID.
        Parameters:
        oid - the child's OID
        defaultRegexp - The regexp to use
        defaultPattern - The compiled version of the regexp
    • Method Detail

      • getRegexp

        public String getRegexp()
        Get the default regexp (either the original one, or the one that has been set)
        Returns:
        The default regexp
      • isValidSyntax

        public boolean isValidSyntax​(Object value)
        Determines if the attribute's value conforms to the attribute syntax.
        Overrides:
        isValidSyntax in class SyntaxChecker
        Parameters:
        value - the value of some attribute with the syntax
        Returns:
        true if the value is in the valid syntax, false otherwise