命名优化提交
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.example.workutils;
|
||||
|
||||
import com.example.workutils.system.tool.Tool;
|
||||
import com.example.workutils.system.tool.Registry;
|
||||
import com.example.workutils.system.tool.ToolRegistry;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -16,10 +16,10 @@ import java.util.Scanner;
|
||||
@Slf4j
|
||||
public class WorkUtilsApplication implements CommandLineRunner {
|
||||
|
||||
private final Registry registry;
|
||||
private final ToolRegistry toolRegistry;
|
||||
|
||||
public WorkUtilsApplication(Registry registry) {
|
||||
this.registry = registry;
|
||||
public WorkUtilsApplication(ToolRegistry toolRegistry) {
|
||||
this.toolRegistry = toolRegistry;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -37,7 +37,7 @@ public class WorkUtilsApplication implements CommandLineRunner {
|
||||
|
||||
private void showInteractiveMenu() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
registry.runMainMenu(scanner);
|
||||
toolRegistry.runMainMenu(scanner);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class WorkUtilsApplication implements CommandLineRunner {
|
||||
private void processCommand(String... args) throws Exception {
|
||||
String command = args[0].toLowerCase();
|
||||
|
||||
Optional<Tool> toolOpt = registry.getToolByCommand(command);
|
||||
Optional<Tool> toolOpt = toolRegistry.getToolByCommand(command);
|
||||
if (toolOpt.isPresent()) {
|
||||
Tool tool = toolOpt.get();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user