Package com.vaadin.data
Interface Validator
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractStringValidator,AbstractValidator,BeanValidator,BigDecimalRangeValidator,BigIntegerRangeValidator,ByteRangeValidator,CompositeValidator,DateRangeValidator,DoubleRangeValidator,DoubleValidator,EmailValidator,FloatRangeValidator,IntegerRangeValidator,IntegerValidator,LongRangeValidator,NullValidator,RangeValidator,RegexpValidator,ShortRangeValidator,StringLengthValidator
public interface Validator extends Serializable
Interface that implements a method for validating if anObjectis valid or not.Implementors of this class can be added to any
Validatableimplementor to verify its value.validate(Object)can be used to check if a value is valid. AnValidator.InvalidValueExceptionwith an appropriate validation error message is thrown if the value is not valid.Validators must not have any side effects.
Since Vaadin 7, the method isValid(Object) does not exist in the interface -
validate(Object)should be used instead, and the exception caught where applicable. Concrete classes implementingValidatorcan still internally implement and use isValid(Object) for convenience or to ease migration from earlier Vaadin versions.- Since:
- 3.0
- Author:
- Vaadin Ltd.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classValidator.EmptyValueExceptionA specific type ofValidator.InvalidValueExceptionthat indicates that validation failed because the value was empty.static classValidator.InvalidValueExceptionException that is thrown by aValidatorwhen a value is invalid.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidvalidate(Object value)Checks the given value against this validator.
-
-
-
Method Detail
-
validate
void validate(Object value) throws Validator.InvalidValueException
Checks the given value against this validator. If the value is valid the method does nothing. If the value is invalid, anValidator.InvalidValueExceptionis thrown.- Parameters:
value- the value to check- Throws:
Validator.InvalidValueException- if the value is invalid
-
-