-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandExecutor.java
More file actions
26 lines (20 loc) · 898 Bytes
/
CommandExecutor.java
File metadata and controls
26 lines (20 loc) · 898 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
package com.javarush.task.task31.task3110;
import com.javarush.task.task31.task3110.command.*;
import java.util.HashMap;
import java.util.Map;
public class CommandExecutor {
private static final Map<Operation, Command> allKnownCommandsMap = new HashMap<>();
static {
allKnownCommandsMap.put(Operation.CREATE, new ZipCreateCommand());
allKnownCommandsMap.put(Operation.ADD, new ZipAddCommand());
allKnownCommandsMap.put(Operation.REMOVE, new ZipRemoveCommand());
allKnownCommandsMap.put(Operation.EXTRACT, new ZipExtractCommand());
allKnownCommandsMap.put(Operation.CONTENT, new ZipContentCommand());
allKnownCommandsMap.put(Operation.EXIT, new ExitCommand());
}
private CommandExecutor() {
}
public static void execute(Operation operation) throws Exception {
allKnownCommandsMap.get(operation).execute();
}
}