diff options
Diffstat (limited to 'api/src/main')
-rwxr-xr-x | api/src/main/java/org/semver/Version.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/api/src/main/java/org/semver/Version.java b/api/src/main/java/org/semver/Version.java index d7b8dbd..417d8b3 100755 --- a/api/src/main/java/org/semver/Version.java +++ b/api/src/main/java/org/semver/Version.java @@ -40,8 +40,9 @@ public final class Version implements Comparable<Version> { MAJOR, MINOR, PATCH, SPECIAL; } - private static final String FORMAT = "(\\d)\\.(\\d)\\.(\\d)([A-Za-z][0-9A-Za-z-]*)?"; + private static final String FORMAT = "(\\d)\\.(\\d)\\.(\\d)(?:\\.|-)?([A-Za-z][0-9A-Za-z-]*)?"; private static final Pattern PATTERN = Pattern.compile(Version.FORMAT); + private static final String SNAPSHOT_VERSION_SUFFIX = "-SNAPSHOT"; private final int major; private final int minor; @@ -118,6 +119,10 @@ public final class Version implements Comparable<Version> { return !isInDevelopment(); } + public boolean isSnapshot() { + return this.special.endsWith(Version.SNAPSHOT_VERSION_SUFFIX); + } + @Override public int hashCode() { int hash = 5; |