Closed Jprnp closed 4 years ago
@Jprnp I released the version 3.4.0, which provides the method withInvalidIndexErrorMessagesProvider
.
Usage example:
Month month = textIO.newEnumInputReader(Month.class)
.withInvalidIndexErrorMessagesProvider((val, propName, minIdx, maxIdx) ->
Arrays.asList(
"Sorry, but '" + val + "' is not a valid option.",
"Please enter an integer value between " + minIdx + " and " + maxIdx + "."
))
.read("What month were you born in?");
Nice. It works!
Issue solved, thanks!
It would be great if we had the possibility to replace the standard "Enter a value between 1 and X" error message in the EnumInputReader. I'm developing an application in Portuguese, so the default english message doesn't fit well.
By debugging i found that there isn't any checks for a Message Provider in the method getValueFromIndex of class InputReader: