Define validation rules in pure Java