Class DomainValidator
- java.lang.Object
-
- org.apache.bval.extras.constraints.net.DomainValidator
-
- All Implemented Interfaces:
javax.validation.ConstraintValidator<Domain,CharSequence>
public class DomainValidator extends Object implements javax.validation.ConstraintValidator<Domain,CharSequence>
Domain name validation routines.
This validator provides methods for validating Internet domain names and top-level domains.
Domain names are evaluated according to the standards RFC1034, section 3, and RFC1123, section 2.1. No accomodation is provided for the specialized needs of other applications; if the domain name has been URL-encoded, for example, validation will fail even though the equivalent plaintext version of the same name would have passed.
Validation is also provided for top-level domains (TLDs) as defined and maintained by the Internet Assigned Numbers Authority (IANA):
isValidInfrastructureTld(java.lang.String)- validates infrastructure TLDs (.arpa, etc.)isValidGenericTld(java.lang.String)- validates generic TLDs (.com, .org, etc.)isValidCountryCodeTld(java.lang.String)- validates country code TLDs (.us, .uk, .cn, etc.)
(NOTE: This class does not provide IP address lookup for domain names or methods to ensure that a given domain name matches a specific IP; see
InetAddressfor that functionality.)
-
-
Constructor Summary
Constructors Constructor Description DomainValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(Domain domain)booleanisValid(CharSequence domain, javax.validation.ConstraintValidatorContext context)
-
-
-
Method Detail
-
isValid
public boolean isValid(CharSequence domain, javax.validation.ConstraintValidatorContext context)
- Specified by:
isValidin interfacejavax.validation.ConstraintValidator<Domain,CharSequence>
-
initialize
public void initialize(Domain domain)
- Specified by:
initializein interfacejavax.validation.ConstraintValidator<Domain,CharSequence>
-
-