diff options
author | Julien Eluard <[email protected]> | 2011-09-13 00:10:21 -0700 |
---|---|---|
committer | Julien Eluard <[email protected]> | 2011-09-13 00:10:21 -0700 |
commit | 37a8a5cbc5d9d941b5e96665ef0409b0999c5ee0 (patch) | |
tree | 74d7629461cebfd69ba4772ceff066956cdd1566 /api/src/main | |
parent | e4e8186f31410d9147d80d30c0bcdc1314a85382 (diff) |
Added support for Maven/OSGI version scheme.
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; |