Java Code Examples for com.github.zafarkhaja.semver.Version#getPatchVersion()
The following examples show how to use
com.github.zafarkhaja.semver.Version#getPatchVersion() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionWrapper.java From LibScout with Apache License 2.0 | 6 votes |
public static SEMVER getExpectedSemver(Version v0, Version v1) { if (v0.getMajorVersion() < v1.getMajorVersion()) { return SEMVER.MAJOR; } else if (v0.getMajorVersion() == v1.getMajorVersion()) { if (v0.getMinorVersion() < v1.getMinorVersion()) { return SEMVER.MINOR; } else if (v0.getMinorVersion() == v1.getMinorVersion()) { if (v0.getPatchVersion() < v1.getPatchVersion()) { return SEMVER.PATCH; } else if (v0.getPatchVersion() == v1.getPatchVersion()) { if (!v1.getBuildMetadata().isEmpty()) // subpatch levels are encoded by build meta data through VersionWrapper return SEMVER.PATCH; } else return null; } } return null; }
Example 2
Source File: VersionWrapper.java From LibScout with Apache License 2.0 | 5 votes |
/** * Determines change between two versions * @param versionStr0 first version string * @param versionStr1 second version string * @return version change, one of ["major", "minor", "patch"] or null if some error occurs */ // TODO TODO rewrite public static String determineVersionChange(String versionStr0, String versionStr1) { Version v0 = VersionWrapper.valueOf(versionStr0); Version v1 = VersionWrapper.valueOf(versionStr1); if (v0.getMajorVersion() < v1.getMajorVersion()) { return SEMVER.MAJOR.toString(); } else if (v0.getMajorVersion() == v1.getMajorVersion()) { if (v0.getMinorVersion() < v1.getMinorVersion()) { return SEMVER.MINOR.toString(); } else if (v0.getMinorVersion() == v1.getMinorVersion()) { if (v0.getPatchVersion() < v1.getPatchVersion()) { return SEMVER.PATCH.toString(); } else if (v0.getPatchVersion() == v1.getPatchVersion()) { if (!v1.getBuildMetadata().isEmpty()) // subpatch levels are encoded by build meta data through VersionWrapper return SEMVER.PATCH.toString(); } else return null; } } return null; }
Example 3
Source File: VersionWrapper.java From LibScout with Apache License 2.0 | 5 votes |
public static String getTruncatedVersion(Version v) { String vStr = "" + v.getMajorVersion(); if (v.getMinorVersion() > 0 || (v.getMinorVersion() == 0 && v.getPatchVersion() > 0)) { vStr += "." + v.getMinorVersion(); if (v.getPatchVersion() > 0) vStr += "." + v.getPatchVersion(); if (v.getBuildMetadata().length() > 1) vStr += "-" + v.getBuildMetadata(); } return vStr; }