Update command/command_handler.py
Browse files- command/command_handler.py +14 -0
command/command_handler.py
CHANGED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Optional
|
2 |
+
from abc import ABC, abstractmethod
|
3 |
+
|
4 |
+
class CommandHandler(ABC):
|
5 |
+
def __init__(self, successor: Optional["CommandHandler"] = None):
|
6 |
+
self.successor = successor
|
7 |
+
|
8 |
+
def handle_command(self, command):
|
9 |
+
if self.successor:
|
10 |
+
self.successor.handle_command(command)
|
11 |
+
|
12 |
+
@abstractmethod
|
13 |
+
def execute_command(self):
|
14 |
+
"""Method of processing command execution logic"""
|