From: Decebal Suiu Date: Mon, 24 Jun 2024 13:24:06 +0000 (+0300) Subject: Improve code readability X-Git-Tag: release-3.12.0~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b1db6c9a509cd7758345a5ca2e51a87c089cdb85;p=pf4j.git Improve code readability --- diff --git a/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java b/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java index bd6b297..e8ff380 100644 --- a/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java +++ b/pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java @@ -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); } + }