Class DomainValidator

java.lang.Object
com.alibaba.fastjson2.util.DomainValidator

public class DomainValidator extends Object
  • Constructor Details

    • DomainValidator

      public DomainValidator()
  • Method Details

    • isValid

      public static boolean isValid(String domain)
      Returns true if the specified String parses as a valid domain name with a recognized top-level domain. The parsing is case-insensitive.
      Parameters:
      domain - the parameter to check for domain name syntax
      Returns:
      true if the parameter is a valid domain name
    • isValidTld

      public static boolean isValidTld(String tld)
      Returns true if the specified String matches any IANA-defined top-level domain. Leading dots are ignored if present. The search is case-insensitive.
      Parameters:
      tld - the parameter to check for TLD status, not null
      Returns:
      true if the parameter is a TLD
    • isValidGenericTld

      public static boolean isValidGenericTld(String gTld)
      Returns true if the specified String matches any IANA-defined generic top-level domain. Leading dots are ignored if present. The search is case-insensitive.
      Parameters:
      gTld - the parameter to check for generic TLD status, not null
      Returns:
      true if the parameter is a generic TLD