diff options
author | Shevek <[email protected]> | 2015-01-01 10:44:27 -0800 |
---|---|---|
committer | Shevek <[email protected]> | 2015-01-01 10:44:27 -0800 |
commit | 3e0f34f77c1ea1f9b27b097efaa8bcf3dee19e4b (patch) | |
tree | eee67b9123714cdc54f45b3f4c509e483b60c6d7 /src/main/velocity | |
parent | 86f7ce7b960f504f299b0e43ffcd6a179566144a (diff) |
Fix #10 using build-time metadata.
Diffstat (limited to 'src/main/velocity')
-rw-r--r-- | src/main/velocity/org/anarres/cpp/Version.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/velocity/org/anarres/cpp/Version.java b/src/main/velocity/org/anarres/cpp/Version.java index 62494b5..cedd6bb 100644 --- a/src/main/velocity/org/anarres/cpp/Version.java +++ b/src/main/velocity/org/anarres/cpp/Version.java @@ -17,6 +17,7 @@ package org.anarres.cpp; +import javax.annotation.CheckForNull; import javax.annotation.Nonnull; /** @@ -35,12 +36,14 @@ public class Version { private static final int major; private static final int minor; private static final int patch; + private static final String modifier; static { String[] tmp = VERSION.split("[\\.-]"); major = Integer.parseInt(tmp[0]); minor = Integer.parseInt(tmp[1]); patch = Integer.parseInt(tmp[2]); + modifier = (tmp.length > 3) ? tmp[3] : null; } @Nonnull @@ -60,6 +63,15 @@ public class Version { return patch; } + @CheckForNull + public static String getModifier() { + return modifier; + } + + public static boolean isSnapshot() { + return "SNAPSHOT".equalsIgnoreCase(getModifier()); + } + public static void main(String[] args) { System.out.println("Version " + VERSION); System.out.println("getVersion() returns " + getVersion()); |