|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Validator
Interface that implements a method for validating if an Object
is
valid or not.
Implementors of this class can be added to any
Validatable
implementor to verify its
value.
isValid(Object)
and validate(Object)
can be used to check
if a value is valid. isValid(Object)
and validate(Object)
must use the same validation logic so that iff isValid(Object)
returns false, validate(Object)
throws an
Validator.InvalidValueException
.
Validators must not have any side effects.
Nested Class Summary | |
---|---|
static class |
Validator.EmptyValueException
A specific type of Validator.InvalidValueException that indicates that
validation failed because the value was empty. |
static class |
Validator.InvalidValueException
Exception that is thrown by a Validator when a value is invalid. |
Method Summary | |
---|---|
boolean |
isValid(Object value)
Tests if the given value is valid. |
void |
validate(Object value)
Checks the given value against this validator. |
Method Detail |
---|
void validate(Object value) throws Validator.InvalidValueException
Validator.InvalidValueException
is thrown.
value
- the value to check
Validator.InvalidValueException
- if the value is invalidboolean isValid(Object value)
validate(Object)
so that validate(Object)
throws an
error iff this method returns false.
value
- the value to check
true
if the value is valid, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |