]> source.dussan.org Git - pf4j.git/commitdiff
Improve code readability
authorDecebal Suiu <decebal.suiu@gmail.com>
Mon, 24 Jun 2024 13:24:06 +0000 (16:24 +0300)
committerDecebal Suiu <decebal.suiu@gmail.com>
Mon, 24 Jun 2024 13:24:06 +0000 (16:24 +0300)
pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java

index bd6b29748df736d4447997291c37966176e720dc..e8ff380f18303be804c84437dfd56212cec0096c 100644 (file)
@@ -146,7 +146,6 @@ public class DefaultPluginDescriptor implements PluginDescriptor {
         return this;
     }
 
-
     protected DefaultPluginDescriptor setPluginVersion(String version) {
         this.version = version;
 
@@ -171,13 +170,18 @@ public class DefaultPluginDescriptor implements PluginDescriptor {
         if (dependencies != null) {
             dependencies = dependencies.trim();
             if (!dependencies.isEmpty()) {
-                String[] tokens = dependencies.split(",");
-                for (String dependency : tokens) {
-                    dependency = dependency.trim();
-                    if (!dependency.isEmpty()) {
-                        this.dependencies.add(new PluginDependency(dependency));
-                    }
-                }
+                setDependencies(dependencies.split(","));
+            }
+        }
+
+        return this;
+    }
+
+    protected PluginDescriptor setDependencies(String... dependencies) {
+        for (String dependency : dependencies) {
+            dependency = dependency.trim();
+            if (!dependency.isEmpty()) {
+                this.dependencies.add(new PluginDependency(dependency));
             }
         }
 
@@ -209,4 +213,5 @@ public class DefaultPluginDescriptor implements PluginDescriptor {
     public int hashCode() {
         return Objects.hash(pluginId, pluginDescription, pluginClass, version, requires, provider, dependencies, license);
     }
+
 }