Interface Program<O extends Json<?>>

  • Type Parameters:
    O - the type of the Json, either an object or an array
    All Known Implementing Classes:
    JsArrayConsole, JsObjConsole

    public interface Program<O extends Json<?>>
    Represents a side effect that interact with the user through the standard console to compose a Json
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      O exec()
      Execute the program
      default O exec​(java.lang.String promptMessage, java.util.function.Function<O,​java.lang.String> resultFn)
      Execute the program, printing out a message before and after executing.
    • Method Detail

      • exec

        default O exec​(java.lang.String promptMessage,
                       java.util.function.Function<O,​java.lang.String> resultFn)
                throws java.util.concurrent.ExecutionException,
                       java.lang.InterruptedException
        Execute the program, printing out a message before and after executing.
        Parameters:
        promptMessage - the message printed out before the execution
        resultFn - function that takes the result as a parameter and return the messages printed out after the execution
        Returns:
        a Json
        Throws:
        java.util.concurrent.ExecutionException - if this future completed exceptionally
        java.lang.InterruptedException - if the current thread was interrupted
      • exec

        O exec()
        throws java.util.concurrent.ExecutionException,
               java.lang.InterruptedException
        Execute the program
        Returns:
        a Json
        Throws:
        java.util.concurrent.ExecutionException - if this future completed exceptionally
        java.lang.InterruptedException - if the current thread was interrupted