Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.cerebro.gorgone.commons; import com.vaadin.data.Validator; /** * * @author matteo */ public class PasswordValidator implements Validator { @Override public void validate(Object value) throws InvalidValueException { if (!(value instanceof String && ((String) value).matches(".*\\d.*") && ((String) value).length() > 8)) throw new InvalidValueException("Password non valida"); } }