class OptionalFieldMaxLengthValidator implements ObjectValidator<StringMaxLengthValidator.MaxLengthRequirement> {

    @Override
    public void validate(@NotNull StringMaxLengthValidator.MaxLengthRequirement object, @NotNull MessageError messageError) {
        if (StringUtils.isNotBlank(object.getField())) {
            stringMaxLengthValidator.validate(object, messageError);
        }
    }

}