Class IPAddressArgumentValueValidator

    • Constructor Summary

      Constructors 
      Constructor Description
      IPAddressArgumentValueValidator()
      Creates a new IP address argument value validator that will accept both IPv4 and IPv6 addresses.
      IPAddressArgumentValueValidator​(boolean acceptIPv4Addresses, boolean acceptIPv6Addresses)
      Creates a new IP address argument value validator that will accept both IPv4 and IPv6 addresses.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acceptIPv4Addresses()
      Indicates whether to accept IPv4 addresses.
      boolean acceptIPv6Addresses()
      Indicates whether to accept IPv6 addresses.
      static boolean isValidNumericIPAddress​(java.lang.String s)
      Indicates whether the provided string represents a valid IPv4 or IPv6 address.
      static boolean isValidNumericIPv4Address​(java.lang.String s)
      Indicates whether the provided string is a valid IPv4 address.
      static boolean isValidNumericIPv6Address​(java.lang.String s)
      Indicates whether the provided string is a valid IPv6 address.
      java.lang.String toString()
      Retrieves a string representation of this argument value validator.
      void toString​(java.lang.StringBuilder buffer)
      Appends a string representation of this argument value validator to the provided buffer.
      void validateArgumentValue​(Argument argument, java.lang.String valueString)
      Examines the value(s) assigned to the provided argument to determine whether they are acceptable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IPAddressArgumentValueValidator

        public IPAddressArgumentValueValidator()
        Creates a new IP address argument value validator that will accept both IPv4 and IPv6 addresses.
      • IPAddressArgumentValueValidator

        public IPAddressArgumentValueValidator​(boolean acceptIPv4Addresses,
                                               boolean acceptIPv6Addresses)
        Creates a new IP address argument value validator that will accept both IPv4 and IPv6 addresses. At least one of the acceptIPv4Addresses and acceptIPv6Addresses arguments must have a value of true.
        Parameters:
        acceptIPv4Addresses - Indicates whether IPv4 addresses will be accepted. If this is false, then the acceptIPv6Addresses argument must be true.
        acceptIPv6Addresses - Indicates whether IPv6 addresses will be accepted. If this is false, then the acceptIPv4Addresses argument must be true.
    • Method Detail

      • acceptIPv4Addresses

        public boolean acceptIPv4Addresses()
        Indicates whether to accept IPv4 addresses.
        Returns:
        true if IPv4 addresses should be accepted, or false if not.
      • acceptIPv6Addresses

        public boolean acceptIPv6Addresses()
        Indicates whether to accept IPv6 addresses.
        Returns:
        true if IPv6 addresses should be accepted, or false if not.
      • validateArgumentValue

        public void validateArgumentValue​(@NotNull
                                          Argument argument,
                                          @NotNull
                                          java.lang.String valueString)
                                   throws ArgumentException
        Examines the value(s) assigned to the provided argument to determine whether they are acceptable.
        Specified by:
        validateArgumentValue in class ArgumentValueValidator
        Parameters:
        argument - The argument to which the value is being provided.
        valueString - The string representation of the value to be validated. This value will have already passed any normal validation performed by the argument.
        Throws:
        ArgumentException - If the provided value is determined to be unacceptable.
      • isValidNumericIPAddress

        public static boolean isValidNumericIPAddress​(@Nullable
                                                      java.lang.String s)
        Indicates whether the provided string represents a valid IPv4 or IPv6 address.
        Parameters:
        s - The string for which to make the determination.
        Returns:
        true if the provided string represents a valid IPv4 or IPv6 address, or false if not.
      • isValidNumericIPv4Address

        public static boolean isValidNumericIPv4Address​(@Nullable
                                                        java.lang.String s)
        Indicates whether the provided string is a valid IPv4 address.
        Parameters:
        s - The string for which to make the determination.
        Returns:
        true if the provided string represents a valid IPv4 address, or false if not.
      • isValidNumericIPv6Address

        public static boolean isValidNumericIPv6Address​(@Nullable
                                                        java.lang.String s)
        Indicates whether the provided string is a valid IPv6 address.
        Parameters:
        s - The string for which to make the determination.
        Returns:
        true if the provided string represents a valid IPv6 address, or false if not.
      • toString

        @NotNull
        public java.lang.String toString()
        Retrieves a string representation of this argument value validator.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of this argument value validator.
      • toString

        public void toString​(@NotNull
                             java.lang.StringBuilder buffer)
        Appends a string representation of this argument value validator to the provided buffer.
        Parameters:
        buffer - The buffer to which the string representation should be appended.