-
Notifications
You must be signed in to change notification settings - Fork 274
Expand file tree
/
Copy pathLineController.java
More file actions
43 lines (35 loc) · 1.09 KB
/
LineController.java
File metadata and controls
43 lines (35 loc) · 1.09 KB
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
33
34
35
36
37
38
39
40
41
42
43
package subway.controller;
import subway.domain.Line;
import subway.service.LineService;
import subway.view.Input;
import subway.view.Output;
public class LineController {
private LineController() {
}
public void save() {
try {
LineService.save(new Line(Input.input(Input.PLEASE_INPUT_LINE_NAME)));
} catch (IllegalArgumentException e) {
Output.printNewLine();
System.out.println(e.getMessage());
}
}
public void remove() {
try {
LineService.remove(Input.input(Input.PLEASE_INPUT_REMOVE_LINE_NAME));
} catch (IllegalArgumentException e) {
Output.printNewLine();
System.out.println(e.getMessage());
}
}
public void getList() {
Output.print(Output.LINE_LIST);
Output.printByList(LineService.getAllLines());
}
public static LineController getInstance() {
return LineController.LazyHolder.INSTANCE;
}
private static class LazyHolder {
private static final LineController INSTANCE = new LineController();
}
}