diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2024-06-24 16:24:06 +0300 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2024-06-24 16:24:06 +0300 |
commit | b1db6c9a509cd7758345a5ca2e51a87c089cdb85 (patch) | |
tree | 319cc35bf70e93c1404dec2c011e944f8e18ac8b | |
parent | a13568fe85403b83d5c23c93ba8f21fca3113bfe (diff) | |
download | pf4j-b1db6c9a509cd7758345a5ca2e51a87c089cdb85.tar.gz pf4j-b1db6c9a509cd7758345a5ca2e51a87c089cdb85.zip |
Improve code readability
-rw-r--r-- | pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java | 21 |
1 files changed, 13 insertions, 8 deletions
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); } + } |