From 47f49b62921a109515fd549ac1d8a06360366368 Mon Sep 17 00:00:00 2001 From: Andrea Di Cesare Date: Fri, 15 Dec 2023 13:13:30 +0100 Subject: [PATCH] :recycle: Some refactoring in PluginsFactory --- .../main/java/org/restheart/plugins/PluginsFactory.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/restheart/plugins/PluginsFactory.java b/core/src/main/java/org/restheart/plugins/PluginsFactory.java index dd8486b4b..37680b110 100644 --- a/core/src/main/java/org/restheart/plugins/PluginsFactory.java +++ b/core/src/main/java/org/restheart/plugins/PluginsFactory.java @@ -204,14 +204,14 @@ Set>> providers() { return providersCache; } - private static Map> providersTypes = new HashMap<>(); + private static final Map> providersTypes = new HashMap<>(); /** * NOTE: this is availabe only after providers instantiation happening in method providers() * @return a Map whose keys are the provider's name and values are the classes of the provided objects */ static Map> providersTypes() { - if (PluginsScanner.providers().size() > 0 && providersTypes.keySet().size() == 0) { + if (!PluginsScanner.providers().isEmpty() && providersTypes.keySet().isEmpty()) { throw new IllegalStateException("providersTypes are available only after providers instantiation happening in method providers()"); } return providersTypes; @@ -305,9 +305,9 @@ private Plugin instantiatePlugin(Class pc, String pluginType, String plu } } - private List PLUGINS_TO_INJECT_DEPS = new ArrayList<>(); + private final List PLUGINS_TO_INJECT_DEPS = new ArrayList<>(); - private HashMap> INSTANTIATED_PLUGINS_RECORDS = new HashMap<>(); + private final HashMap> INSTANTIATED_PLUGINS_RECORDS = new HashMap<>(); void injectDependencies() { for (var ip: PLUGINS_TO_INJECT_DEPS) {