Package jsonvalues.console
Class JsArrayIO
- java.lang.Object
-
- jsonvalues.console.JsArrayIO
-
public class JsArrayIO extends Object implements JsIO<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 JsArrayIO()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsFuture<JsArray>apply(JsPath path)JsArrayexec()Execute the programstatic JsArrayIOof(JsIO<?> head, JsIO<?>... tail)static factory method to create a JsArrayIOConsumer<JsPath>promptMessage()
-
-
-
Method Detail
-
of
public static JsArrayIO of(JsIO<?> head, JsIO<?>... 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:ProgramExecute the program- Specified by:
execin 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:
promptMessagein interfaceJsIO<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
-
-