replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like thevalidate
method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case you could add adefault
case.
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like thevalidate
method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case.
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like thevalidate
method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case.
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like the [validate
](http://docs.oracle.com/javaee/7 /api/javax/validation/Validator.html#validate-T-java.lang.Class...-)validate
method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case.
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like the [validate
](http://docs.oracle.com/javaee/7 /api/javax/validation/Validator.html#validate-T-java.lang.Class...-) method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case.
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like thevalidate
method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case.
This is a very nice way to do it yes.
A couple of comments:
- The method performing the validation shouldn't be named
isValid
, because it does more than checking if the given IP adress is valid. If that were the case, it would only return a booleantrue
orfalse
, saying whether IP given was valid or not. The method actually returns a status describing exactly what didn't validate. Consider renaming it tovalidate
(a bit like the [validate
](http://docs.oracle.com/javaee/7 /api/javax/validation/Validator.html#validate-T-java.lang.Class...-) method of the Bean Validation API). - Beware that there can be IPv4 and IPv6 addresses. Your code only handles the former case.
- If you use a
switch
to test the validation status, you could add adefault
case.
lang-java