For folks who may not be familiar with Guava, it is a framework of really helpful utilities that can be used for a variety of situations. Most folks who use Guava in my experience use the collections classes. However, there is a boon for anyone who digs a little deeper.
We will use two specific classes from the Guava framework to do our validations. The first is
InternetDomainName
which is used to validate the domain name. The other is InetAddresses
to check our IP address for validity.There are some caveats to the
InternetDomainName
class which are explained here: InternetDomainNameExplained.
In the code below, we see that it is very easy to use and it works very well.
No comments:
Post a Comment