-
Notifications
You must be signed in to change notification settings - Fork 273
Expand file tree
/
Copy pathStationController.java
More file actions
44 lines (36 loc) · 1.15 KB
/
Copy pathStationController.java
File metadata and controls
44 lines (36 loc) · 1.15 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
44
package subway.controller;
import subway.domain.Station;
import subway.service.StationService;
import subway.view.Input;
import subway.view.Output;
public class StationController {
private StationController() {
}
public void save() {
try {
StationService.save(new Station(Input.input(Input.PLEASE_INPUT_STATION_NAME)));
} catch (IllegalArgumentException e) {
Output.printNewLine();
System.out.println(e.getMessage());
}
}
public void remove() {
try {
Output.printNewLine();
StationService.remove(Input.input(Input.PLEASE_INPUT_REMOVE_STATION_NAME));
} catch (IllegalArgumentException e) {
Output.printNewLine();
System.out.println(e.getMessage());
}
}
public void getList() {
Output.print(Output.STATION_LIST);
Output.printByList(StationService.getAllStations());
}
public static StationController getInstance() {
return LazyHolder.INSTANCE;
}
private static class LazyHolder {
private static final StationController INSTANCE = new StationController();
}
}