class StringMaxLengthValidator implements ObjectValidator<StringMaxLengthValidator.MaxLengthRequirement> {

    @Override
    public void validate(@NotNull MaxLengthRequirement object, @NotNull MessageError messageError) {
        if (object.getField() != null && object.getField().length() > object.getMaxLength()) {
            errorBuildingService.enrichMessageError(messageError, TppMessageInformation.of(FORMAT_ERROR_OVERSIZE_FIELD, object.getFieldName(), object.getMaxLength()));
        }
    }

}