Package jsonvalues.console
Class JsArrayConsole
- java.lang.Object
-
- jsonvalues.console.JsArrayConsole
-
- All Implemented Interfaces:
java.util.function.Function<JsPath,JsFuture<JsArray>>,JsConsole<JsArray>,Program<JsArray>
public class JsArrayConsole extends java.lang.Object implements JsConsole<JsArray>, Program<JsArray>
represents a supplier of a completable future than composes a json array from the user inputs in the standard console. It has the same recursive structure as a json array. Each value of the array has a supplier of a completable future associated that, when executed, prints out its path in the standard console and waits for the user to type in a value and press Enter. When the user fills out all the values, all the futures are completed and a json array is composed.
-
-
Constructor Summary
Constructors Constructor Description JsArrayConsole()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsFuture<JsArray>apply(JsPath path)JsArrayexec()Execute the programjava.util.function.Consumer<JsPath>promptMessage()static JsArrayConsoletuple(JsConsole<?> head, JsConsole<?>... tail)static factory method to create a JsArrayIO
-
-
-
Method Detail
-
tuple
public static JsArrayConsole tuple(JsConsole<?> head, JsConsole<?>... tail)
static factory method to create a JsArrayIO- Parameters:
head- the headtail- the tail- Returns:
- a JsArrayIO
-
exec
public JsArray exec() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Description copied from interface:ProgramExecute the program
-
promptMessage
public java.util.function.Consumer<JsPath> promptMessage()
- Specified by:
promptMessagein interfaceJsConsole<JsArray>- Returns:
- consumer that accepts a path and prints out a message indicating to the user that they must type in the value associated to that path
-
-