summaryrefslogtreecommitdiffstats
path: root/pf4j
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2024-06-24 16:24:06 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2024-06-24 16:24:06 +0300
commitb1db6c9a509cd7758345a5ca2e51a87c089cdb85 (patch)
tree319cc35bf70e93c1404dec2c011e944f8e18ac8b /pf4j
parenta13568fe85403b83d5c23c93ba8f21fca3113bfe (diff)
downloadpf4j-b1db6c9a509cd7758345a5ca2e51a87c089cdb85.tar.gz
pf4j-b1db6c9a509cd7758345a5ca2e51a87c089cdb85.zip
Improve code readability
Diffstat (limited to 'pf4j')
-rw-r--r--pf4j/src/main/java/org/pf4j/DefaultPluginDescriptor.java21
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);
}
+
}