--- a/src/main/java/de/uapcore/lightpit/ModuleManager.java Wed May 13 18:55:05 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/ModuleManager.java Wed May 13 21:10:23 2020 +0200 @@ -36,7 +36,10 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; /** * Scans registered servlets for LightPIT modules. @@ -55,7 +58,7 @@ /** * Maps class names to module information. */ - private final Map<String, LightPITModule> registeredModules = new HashMap<>(); + private final List<LightPITModule> registeredModules = new ArrayList<>(); /** * Contains the menu entries for the loaded modules. @@ -114,7 +117,7 @@ private void handleServletRegistration(String name, Registration reg) { final Optional<LightPITModule> moduleInfo = getModuleInfo(reg); if (moduleInfo.isPresent()) { - registeredModules.put(reg.getClassName(), moduleInfo.get()); + registeredModules.add(moduleInfo.get()); LOG.info("Module detected: {}", name); } else { LOG.debug("Servlet {} is no module, skipping.", name); @@ -145,16 +148,15 @@ */ private void createMainMenu() { mainMenu.clear(); - registeredModules.entrySet() + registeredModules .stream() - .filter(mod -> !mod.getValue().systemModule()) + .filter(mod -> !mod.systemModule()) .map(mod -> new MenuEntry( - mod.getKey(), new ResourceKey( - mod.getValue().bundleBaseName(), - mod.getValue().menuKey()), - mod.getValue().modulePath(), - mod.getValue().defaultPriority())) + mod.bundleBaseName(), + mod.menuKey()), + mod.modulePath(), + mod.defaultPriority())) .sorted() .forEachOrdered(mainMenu::add); }