diff options
author | COLLIGNON Thomas <tomiphone3g@gmail.com> | 2017-07-06 10:40:24 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2017-07-06 11:40:24 +0300 |
commit | 49bd1f59964355ced04f97079d1349227b0f69f3 (patch) | |
tree | 8ba084476c6b84d16d3094b6021a1d8a5243bd6e /pf4j/src | |
parent | 84c856b3591b10b192bd6bb452d0760933a33b35 (diff) | |
download | pf4j-49bd1f59964355ced04f97079d1349227b0f69f3.tar.gz pf4j-49bd1f59964355ced04f97079d1349227b0f69f3.zip |
Refactor ManifestPluginDescriptorFinder to allow custom managing of V… (#154)
Diffstat (limited to 'pf4j/src')
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java index de0f84e..394773c 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinder.java @@ -58,7 +58,7 @@ public abstract class ManifestPluginDescriptorFinder implements PluginDescriptor String version = attributes.getValue("Plugin-Version"); if (StringUtils.isNotEmpty(version)) { - pluginDescriptor.setPluginVersion(Version.valueOf(version)); + pluginDescriptor.setPluginVersion(createPluginVersion(version)); } String provider = attributes.getValue("Plugin-Provider"); @@ -76,6 +76,17 @@ public abstract class ManifestPluginDescriptorFinder implements PluginDescriptor return pluginDescriptor; } + /** + * Parse version to semver {@link Version} object. + * Example : 1.1.1.RC1 -> 1.1.1-RC1. + * This may be override to use a custom parsing to semver Version. + * @param version given string to be the plugin version + * @return a semver version + */ + protected Version createPluginVersion(String version) { + return Version.valueOf(version); + } + protected PluginDescriptor createPluginDescriptorInstance() { return new PluginDescriptor(); } |