From fde642e63a6a0165d0e60b80f6fc559368f712e7 Mon Sep 17 00:00:00 2001 From: decebals Date: Thu, 2 May 2019 21:51:05 +0300 Subject: [PATCH] Extract constants for some strings --- .../main/java/org/pf4j/AbstractPluginManager.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index a940610..9e86909 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -45,6 +45,8 @@ public abstract class AbstractPluginManager implements PluginManager { private static final Logger log = LoggerFactory.getLogger(AbstractPluginManager.class); public static final String PLUGINS_DIR_PROPERTY_NAME = "pf4j.pluginsDir"; + public static final String DEFAULT_PLUGINS_DIR = "plugins"; + public static final String DEVELOPMENT_PLUGINS_DIR = "../plugins"; private Path pluginsRoot; @@ -685,19 +687,15 @@ public abstract class AbstractPluginManager implements PluginManager { /** * Add the possibility to override the plugins root. * If a {@link #PLUGINS_DIR_PROPERTY_NAME} system property is defined than this method returns that root. - * If {@link #getRuntimeMode()} returns {@link RuntimeMode#DEVELOPMENT} than {@code ../plugins} - * is returned else this method returns {@code plugins}. + * If {@link #getRuntimeMode()} returns {@link RuntimeMode#DEVELOPMENT} than {@link #DEVELOPMENT_PLUGINS_DIR} + * is returned else this method returns {@link #DEFAULT_PLUGINS_DIR}. * * @return the plugins root */ protected Path createPluginsRoot() { String pluginsDir = System.getProperty(PLUGINS_DIR_PROPERTY_NAME); if (pluginsDir == null) { - if (isDevelopment()) { - pluginsDir = "../plugins"; - } else { - pluginsDir = "plugins"; - } + pluginsDir = isDevelopment() ? DEVELOPMENT_PLUGINS_DIR : DEFAULT_PLUGINS_DIR; } return Paths.get(pluginsDir);