aboutsummaryrefslogtreecommitdiffstats
path: root/api/src/main/java
diff options
context:
space:
mode:
authorAlexander Morozov <[email protected]>2014-10-01 13:41:42 +0700
committerAlexander Morozov <[email protected]>2014-10-01 13:41:42 +0700
commit95232052f900ac565917246b29b56b058cc060da (patch)
tree8254007571478526443aacef36adf8b77d8bbf53 /api/src/main/java
parentb39561c4ade1279eeae42156c741c92529bb2d80 (diff)
Add version compatibility checking. AbstractEnforcerRule will skip non-compatible artifacts in case of auto-detection of previous version .
Diffstat (limited to 'api/src/main/java')
-rwxr-xr-xapi/src/main/java/org/semver/Version.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/api/src/main/java/org/semver/Version.java b/api/src/main/java/org/semver/Version.java
index 4cb54db..83765da 100755
--- a/api/src/main/java/org/semver/Version.java
+++ b/api/src/main/java/org/semver/Version.java
@@ -168,6 +168,14 @@ public final class Version implements Comparable<Version> {
return this.special != null && this.special.isSnapshot();
}
+ /**
+ * @param version version to check with
+ * @return {@code true}, if supplied version is compatible with this version, {@code false} - otherwise
+ */
+ public boolean isCompatible(Version version) {
+ return version != null && this.major == version.major;
+ }
+
@Override
public int hashCode() {
int hash = 5;