-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathConsoleInput.java
More file actions
32 lines (25 loc) · 859 Bytes
/
ConsoleInput.java
File metadata and controls
32 lines (25 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.wonu606.vouchermanager.console;
import java.util.List;
import org.beryx.textio.TextIO;
import org.beryx.textio.TextIoFactory;
import org.springframework.stereotype.Component;
@Component
public class ConsoleInput {
private final TextIO textIO = TextIoFactory.getTextIO();
public String readString(String description) {
return textIO.newStringInputReader()
.read(description);
}
public String readString(List<String> possibleValues, String description) {
return textIO.newStringInputReader()
.withInlinePossibleValues(possibleValues)
.read(description);
}
public Double readDouble(String description) {
return textIO.newDoubleInputReader()
.read(description);
}
public void terminate() {
textIO.dispose();
}
}