Package com.alibaba.fastjson2.util
Class DomainValidator
java.lang.Object
com.alibaba.fastjson2.util.DomainValidator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns true if the specifiedStringparses as a valid domain name with a recognized top-level domain.static booleanisValidGenericTld(String gTld) Returns true if the specifiedStringmatches any IANA-defined generic top-level domain.static booleanisValidTld(String tld) Returns true if the specifiedStringmatches any IANA-defined top-level domain.
-
Constructor Details
-
DomainValidator
public DomainValidator()
-
-
Method Details
-
isValid
Returns true if the specifiedStringparses 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
Returns true if the specifiedStringmatches 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
Returns true if the specifiedStringmatches 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
-