Package jsonvalues.console
Class JsArrayConsole
- java.lang.Object
-
- jsonvalues.console.JsArrayConsole
-
- All Implemented Interfaces:
Function<JsPath,JsFuture<JsArray>>
,JsConsole<JsArray>
,Program<JsArray>
public class JsArrayConsole extends 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)
JsArray
exec()
Execute the programConsumer<JsPath>
promptMessage()
static JsArrayConsole
tuple(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 ExecutionException, InterruptedException
Description copied from interface:Program
Execute the program- Specified by:
exec
in interfaceProgram<JsArray>
- Returns:
- a Json
- Throws:
ExecutionException
- if this future completed exceptionallyInterruptedException
- if the current thread was interrupted
-
promptMessage
public Consumer<JsPath> promptMessage()
- Specified by:
promptMessage
in 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
-
-