Skip to content

Commit b09dc81

Browse files
committed
Add StatementHandlerRegistry
1 parent ceaac78 commit b09dc81

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from typing import Dict
2+
3+
4+
class StatementHandlerRegistry:
5+
"""Registry for statement handlers."""
6+
7+
_handlers: Dict = {}
8+
9+
@classmethod
10+
def register(cls, stmt_type):
11+
"""Register a handler for a specific statement type."""
12+
13+
def decorator(handler):
14+
cls._handlers[stmt_type] = handler
15+
return handler
16+
17+
return decorator
18+
19+
@classmethod
20+
def get_handler(cls, stmt_type):
21+
"""Get the handler for a specific statement type."""
22+
return cls._handlers.get(stmt_type, None)

0 commit comments

Comments
 (0)