private Map<String, Scope> getScopes(List<JqassistantPlugin> plugins) throws PluginRepositoryException { Map<String, Scope> scopes = new HashMap<>(); for (JqassistantPlugin plugin : plugins) { ScopeType scopeType = plugin.getScope(); if (scopeType != null) { for (String scopePluginName : scopeType.getClazz()) { Class<? extends Enum<?>> type = getType(scopePluginName); for (Enum enumConstant : type.getEnumConstants()) { Scope scope = (Scope) enumConstant; String scopeName = scope.getPrefix() + ":" + scope.getName(); scopes.put(scopeName.toLowerCase(), scope); } } } } return scopes; }
private <T extends ScannerPlugin> List<T> getScannerPlugins(List<JqassistantPlugin> plugins) throws PluginRepositoryException { List<T> scannerPlugins = new ArrayList<>(); for (JqassistantPlugin plugin : plugins) { ScannerType scannerType = plugin.getScanner(); if (scannerType != null) { for (String scannerPluginName : scannerType.getClazz()) { T scannerPlugin = createInstance(scannerPluginName); if (scannerPlugin != null) { // properties is mutable, so every plugin should get its // own copy scannerPlugin.initialize(); scannerPlugins.add(scannerPlugin); } } } } return scannerPlugins; }