In Vaadin 7 there was an addValidator function, but in Vaadin 8 it does not exist.
Vaadin 7 Example:
TextField user = new TextField("User:");
user.setRequired(true);
user.setInputPrompt("Your username");
user.addValidator(new NullValidator("Username can't be empty", false));
user.setInvalidAllowed(false);
I found the answer here: Whats New
Example:
new Binder<Person>().forField(tf)
.withValidator(str -> str.length() == 4, "Must be 4 chars")
.withConverter(new StringToIntegerConverter("Must be Integer"))
.withValidator(integer -> integer.equals(2017), "Wrong date")
.bind(Person::getBirthYear, Person::setBirthYear);