Class DefaultInputHandler

    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultInputHandler()
      Empty no-arg constructor
    • Method Summary

      Modifier and Type Method Description
      protected java.io.InputStream getInputStream()
      Returns the input stream from which the user input should be read.
      protected java.lang.String getPrompt​(InputRequest request)
      Constructs user prompt from a request.
      void handleInput​(InputRequest request)
      Prompts and requests input.
      • Methods inherited from class java.lang.Object

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

      • DefaultInputHandler

        public DefaultInputHandler()
        Empty no-arg constructor
    • Method Detail

      • handleInput

        public void handleInput​(InputRequest request)
                         throws BuildException
        Prompts and requests input. May loop until a valid input has been entered.
        Specified by:
        handleInput in interface InputHandler
        Parameters:
        request - the request to handle
        Throws:
        BuildException - if not possible to read from console
      • getPrompt

        protected java.lang.String getPrompt​(InputRequest request)
        Constructs user prompt from a request.

        This implementation adds (choice1,choice2,choice3,...) to the prompt for MultipleChoiceInputRequests.

        Parameters:
        request - the request to construct the prompt for. Must not be null.
        Returns:
        the prompt to ask the user
      • getInputStream

        protected java.io.InputStream getInputStream()
        Returns the input stream from which the user input should be read.
        Returns:
        the input stream from which the user input should be read.