From b1db6c9a509cd7758345a5ca2e51a87c089cdb85 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Mon, 24 Jun 2024 16:24:06 +0300 Subject: [PATCH] Improve code readability --- .../org/pf4j/DefaultPluginDescriptor.java | 21 ++++++++++++------- 1 file 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); } + } -- 2.39.5