Package org.pf4j
Class DefaultVersionManager
java.lang.Object
org.pf4j.DefaultVersionManager
- All Implemented Interfaces:
VersionManager
Default implementation for
VersionManager
.
This implementation uses jSemVer (a Java implementation of the SemVer Specification).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkVersionConstraint
(String version, String constraint) Checks if a version satisfies the specified SemVerExpression
string.int
compareVersions
(String v1, String v2) Compare two versions.
-
Constructor Details
-
DefaultVersionManager
public DefaultVersionManager()
-
-
Method Details
-
checkVersionConstraint
Checks if a version satisfies the specified SemVerExpression
string. If the constraint is empty or null then the method returns true. Constraint examples:>2.0.0
(simple),">=1.4.0 & <1.6.0"
(range). See https://github.com/zafarkhaja/jsemver#semver-expressions-api-ranges for more info.- Specified by:
checkVersionConstraint
in interfaceVersionManager
- Parameters:
version
-constraint
-- Returns:
-
compareVersions
Description copied from interface:VersionManager
Compare two versions. It's similar withComparator.compare(Object, Object)
.- Specified by:
compareVersions
in interfaceVersionManager
- Parameters:
v1
-v2
-
-