|
abstract void | validate (Supplier<?> string) throws ValidationException |
|
Enum of Validator implementations.
Definition at line 45 of file Validator.java.
◆ validate()
abstract void Validator.validate |
( |
Supplier<?> |
string | ) |
throws ValidationException |
|
abstract |
Checks that the supplier is valid.
- Parameters
-
string | - a string supplier |
- Exceptions
-
ValidationException | if validation check fails |
◆ validate
Initial value:=(Supplier<?>
string)
throws ValidationException {
try {
Integer.parseInt((String) string.get());
} catch (NumberFormatException ex) {
throw new ValidationException("Error while validating "
+ string.get());
}
}
},
POSITIVE_NUMBER {
@Override
void validate(Supplier<?>
string)
throws ValidationException {
try {
if (Double.compare(0.0, Double.parseDouble(
(String) string.get())) > 0) {
throw new Exception();
}
} catch (Exception ex) {
throw new ValidationException("Error while validating "
+ string.get());
}
}
}
This validator checks that the string represents an integer. Checks that the string represents an integer.
- Parameters
-
string | - a string supplier |
- Exceptions
-
ValidationException | if the validation check fails |
Definition at line 58 of file Validator.java.
The documentation for this enum was generated from the following file:
- build/windows-installer/unpacked/java-se-8u41-ri/sample/annotations/Validator/src/Validator.java