@Override
    public void validate(Object target, Errors errors) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "myPassword", "myPassword.empty");

        Password password = (Password) target;

        String passwordString = password.getMyPassword();
        if (passwordString != null){

            boolean charFound = false;
            boolean digitFound = false;
            boolean invalidCharFound = false;

            for (int i=0;i< passwordString.length();i++){
                boolean currCharValid = false;
                boolean currDigitValid = false;
                char c = passwordString.charAt(i);

                if (Utils.validChar(c)){
                    charFound = true;
                    currCharValid = true;
                }
                else if (Utils.validDigit(c)){
                    digitFound = true;
                    currDigitValid = true;
                }

                if(!currCharValid && !currDigitValid){
                    invalidCharFound = true;
                }
            }

            if (!charFound){
                errors.rejectValue("myPassword", "Password must contain at least one lowercase letter");
            }
            if (!digitFound){
                errors.rejectValue("myPassword", "Password must contain at least one digit");
            }
            if (invalidCharFound){
                errors.rejectValue("myPassword", "Password may only contain lowercase letters and digits");
            }
        }


    }