// check lengths
int length = value.length();
if (getMinLength() == getMaxLength())
if (length != getMinLength())
throw new ValidationException(String.format(SHOULD_BE_EXACTLY, getName(), getMaxLength()));
if (length < getMinLength())
throw new ValidationException(String.format(SHOULD_BE_LONGER, getName(), getMinLength()));
if (length > getMaxLength())
throw new ValidationException(String.format(SHOULD_BE_SHORTER, getName(), getMaxLength()));
}