This project started as an attemp to explore embedded domain specific languages in Java, after reading the paper Evolving an Embedded Domain-Specific Language in Java, by Steve Freeman and Nat Pryce (OOPSLA 2006).
The project's goal is to provide a simple, pure Java, validator with an API that is easy to read, easy to program and feels like a special purpose validation language.
| [top] |
Use the BeanValidator and import all the static methods from the Validators class.
import static com.tzavellas.validation.Validators.*;
import com.tzavellas.validation.BeanValidator;
BeanValidator validator = new BeanValidator(
string("firstName").required(),
string("lastName").required(),
string("email").required().email(),
integer("age").min(18),
date("birthdate").past());
| [top] |
Yes, multiple threads can access concurrently the same BeanValidator instance.
| [top] |
Yes!
See the SpringValidator's documentation and test case for more details.
| [top] |