-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathFrontConsoleIo.java
More file actions
27 lines (22 loc) · 908 Bytes
/
FrontConsoleIo.java
File metadata and controls
27 lines (22 loc) · 908 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
package com.wonu606.vouchermanager.console.cableadapter;
import com.wonu606.vouchermanager.console.AbstractConsoleIo;
import com.wonu606.vouchermanager.console.ConsoleInput;
import com.wonu606.vouchermanager.console.ConsolePrinter;
import org.springframework.stereotype.Component;
@Component
public class FrontConsoleIo extends AbstractConsoleIo {
public FrontConsoleIo(ConsoleInput input, ConsolePrinter printer) {
super(input, printer);
}
@Override
public ConsoleMenu selectMenu() {
displayMenu();
String menuSelection = input.readString(ConsoleMenu.getAllNames(), "Menu");
return ConsoleMenu.getTypeByName(menuSelection);
}
protected void displayMenu() {
String lineFormat = "Type %s to %s the program.\n";
ConsoleMenu.getAllNames().forEach(n ->
printer.displayMessage(String.format(lineFormat, n, n)));
}
}