Write business rules in a refreshing way
ValidationRule rule = DslSampleModel
   .when(userBirthdate.ageAt(today()).greaterOrEquals(18)
   .and(accountEmail.length().lesserOrEquals(maxEmailSize))
   .and(accountCountry.eq(Country.FR))
   .and(accountPhoneNumber.startsWith("+33")))
   .validate();
Run with your existing JavaBeans
SampleModel beanModel = new SampleModel();
˙˙˙
beanModel.setAccount(new Account());
beanModel.getAccount().setPhoneNumber("01 42 90 90 90");
˙˙˙
Result result = rule.executeOn(beanModel);
Enjoy the commodities
System.out.println(rule.readable());
> rule when ((user birthdate age at today > 18
and account email length is < configuration max email size)
and account country = FR)
and account phone number starts with '+33' validate


System.out.println(result.isTrue());
> false

System.out.println(result.getFailureCause());
> account phone number starts with '+33'
dOOv, a fluent API for typesafe domain model validation
Meet dOOv on GitHub >>