com.itmill.toolkit.data
Interface Validator

All Known Implementing Classes:
CompositeValidator, NullValidator, StringLengthValidator

public interface Validator

Object validator interface. Implementors of this class can be added to any Validatable object to verify its value. The Validatable#isValid(Object) iterates all registered Validators, calling their validate(Object) methods. validate(Object) should throw the Validator.InvalidValueException if the given value is not valid by its standards.

Since:
3.0
Version:
5.3.0
Author:
IT Mill Ltd.

Nested Class Summary
static class Validator.EmptyValueException
           
static class Validator.InvalidValueException
          Invalid value exception can be thrown by Validator when a given value is not valid.
 
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

validate

void validate(Object value)
              throws Validator.InvalidValueException
Checks the given value against this validator. If the value is valid this method should do nothing, and if it's not valid, it should throw Validator.InvalidValueException

Parameters:
value - the value to check
Throws:
Validator.InvalidValueException - if the value is not valid

isValid

boolean isValid(Object value)
Tests if the given value is valid.

Parameters:
value - the value to check
Returns:
true for valid value, otherwise false.


Copyright © 2000-2009 IT Mill Ltd. All Rights Reserved.