Class DefaultConfirmBuilder

  • All Implemented Interfaces:
    BaseBuilder<ConfirmBuilder>, ConfirmBuilder

    public class DefaultConfirmBuilder
    extends java.lang.Object
    implements ConfirmBuilder
    Default implementation of ConfirmBuilder. This is now the native implementation that doesn't depend on console-ui.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PromptBuilder addPrompt()
      Add this prompt to the parent builder.
      ConfirmBuilder defaultValue​(boolean defaultValue)
      Set the default value.
      ConfirmBuilder filter​(java.util.function.Function<java.lang.String,​java.lang.String> filter)
      Set a filter function that modifies the actual returned value.
      ConfirmBuilder message​(java.lang.String message)
      Set the message to display to the user.
      ConfirmBuilder name​(java.lang.String name)
      Set the name of this prompt.
      ConfirmBuilder transformer​(java.util.function.Function<java.lang.String,​java.lang.String> transformer)
      Set a transformer function that modifies how the answer is displayed after submission.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultConfirmBuilder

        public DefaultConfirmBuilder​(PromptBuilder parent)
        Create a new DefaultConfirmBuilder with the given parent.
        Parameters:
        parent - the parent builder
    • Method Detail

      • message

        public ConfirmBuilder message​(java.lang.String message)
        Set the message to display to the user.
        Specified by:
        message in interface BaseBuilder<ConfirmBuilder>
        Parameters:
        message - the message
        Returns:
        this builder
      • defaultValue

        public ConfirmBuilder defaultValue​(boolean defaultValue)
        Set the default value.
        Specified by:
        defaultValue in interface ConfirmBuilder
        Parameters:
        defaultValue - the default value
        Returns:
        this builder
      • transformer

        public ConfirmBuilder transformer​(java.util.function.Function<java.lang.String,​java.lang.String> transformer)
        Description copied from interface: BaseBuilder
        Set a transformer function that modifies how the answer is displayed after submission. This does not change the actual returned value. For example, a password prompt might transform the answer to "***".
        Specified by:
        transformer in interface BaseBuilder<ConfirmBuilder>
        Parameters:
        transformer - the transformer function
        Returns:
        this builder instance for method chaining
      • filter

        public ConfirmBuilder filter​(java.util.function.Function<java.lang.String,​java.lang.String> filter)
        Description copied from interface: BaseBuilder
        Set a filter function that modifies the actual returned value. This changes the value stored in the result map. For example, trimming whitespace or converting to lowercase.
        Specified by:
        filter in interface BaseBuilder<ConfirmBuilder>
        Parameters:
        filter - the filter function
        Returns:
        this builder instance for method chaining