Class CustomTextIoStringListReader<T>


  • public class CustomTextIoStringListReader<T>
    extends org.beryx.textio.GenericInputReader<T>
    A custom InputReader for handing the custom list prompt text rather than "Enter your choice" which is not changeable in Text.IO.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.beryx.textio.InputReader

        org.beryx.textio.InputReader.ErrorMessagesProvider, org.beryx.textio.InputReader.InvalidIndexErrorMessagesProvider, org.beryx.textio.InputReader.ParseResult<T extends Object>, org.beryx.textio.InputReader.ValueChecker<T extends Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private String customPrompt  
      • Fields inherited from class org.beryx.textio.GenericInputReader

        parser
      • Fields inherited from class org.beryx.textio.InputReader

        defaultValue, equalsFunc, inlinePossibleValues, inputMasking, inputTrimming, invalidIndexErrorMessagesProvider, itemName, numberedPossibleValues, parseErrorMessagesProvider, possibleValues, promptAdjustments, propertiesConfigurator, PROPS_PREFIX_ERROR_MESSAGE, textTerminalSupplier, valueCheckers, valueFormatter, valueListCheckers
    • Constructor Summary

      Constructors 
      Constructor Description
      CustomTextIoStringListReader​(java.util.function.Supplier<org.beryx.textio.TextTerminal<?>> textTerminalSupplier, java.util.function.Function<String,​org.beryx.textio.InputReader.ParseResult<T>> parser)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean anotherShouldAppendColon​(String s)
      shouldAppendColon in InputReader is private, we need to call it in printPrompt, so we make a copied version which is exact same as shouldAppendColon
      protected void printPrompt​(List<String> prompt, org.beryx.textio.TextTerminal<?> textTerminal)  
      org.beryx.textio.InputReader<T,​org.beryx.textio.GenericInputReader<T>> withCustomPrompt​(String customPrompt)  
      • Methods inherited from class org.beryx.textio.GenericInputReader

        parse
      • Methods inherited from class org.beryx.textio.InputReader

        checkConfiguration, executeWithTerminal, getDefaultErrorMessage, getDefaultErrorMessages, getErrorMessages, getPossibleValue, isPossibleValue, isValueListMode, noDuplicatesChecker, nonEmptyListChecker, parseAndCheck, read, read, readList, readList, readWithPrompt, withDefaultValue, withEqualsFunc, withInlinePossibleValues, withInlinePossibleValues, withInputMasking, withInputTrimming, withInvalidIndexErrorMessagesProvider, withItemName, withNumberedPossibleValues, withNumberedPossibleValues, withParseErrorMessagesProvider, withPossibleValues, withPossibleValues, withPromptAdjustments, withPropertiesConfigurator, withPropertiesPrefix, withValueChecker, withValueFormatter, withValueListChecker
    • Field Detail

      • customPrompt

        private String customPrompt
    • Constructor Detail

      • CustomTextIoStringListReader

        public CustomTextIoStringListReader​(java.util.function.Supplier<org.beryx.textio.TextTerminal<?>> textTerminalSupplier,
                                            java.util.function.Function<String,​org.beryx.textio.InputReader.ParseResult<T>> parser)
    • Method Detail

      • withCustomPrompt

        public org.beryx.textio.InputReader<T,​org.beryx.textio.GenericInputReader<T>> withCustomPrompt​(String customPrompt)
      • printPrompt

        protected void printPrompt​(List<String> prompt,
                                   org.beryx.textio.TextTerminal<?> textTerminal)
        Overrides:
        printPrompt in class org.beryx.textio.InputReader<T,​org.beryx.textio.GenericInputReader<T>>
      • anotherShouldAppendColon

        private static boolean anotherShouldAppendColon​(String s)
        shouldAppendColon in InputReader is private, we need to call it in printPrompt, so we make a copied version which is exact same as shouldAppendColon