-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandExecutor.java
More file actions
25 lines (19 loc) · 852 Bytes
/
CommandExecutor.java
File metadata and controls
25 lines (19 loc) · 852 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
package com.javarush.task.task26.task2613.command;
import com.javarush.task.task26.task2613.Operation;
import com.javarush.task.task26.task2613.exception.InterruptOperationException;
import java.util.HashMap;
import java.util.Map;
public class CommandExecutor {
private static final Map<Operation, Command> allKnownCommandsMap = new HashMap<>();
static {
allKnownCommandsMap.put(Operation.INFO,new InfoCommand());
allKnownCommandsMap.put(Operation.DEPOSIT, new DepositCommand());
allKnownCommandsMap.put(Operation.WITHDRAW, new WithdrawCommand());
allKnownCommandsMap.put(Operation.EXIT, new ExitCommand());
}
private CommandExecutor() {
}
public static final void execute(Operation operation) throws InterruptOperationException {
allKnownCommandsMap.get(operation).execute();
}
}