You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Version.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package com.vaadin;
  2. import java.io.Serializable;
  3. public class Version implements Serializable {
  4. /**
  5. * The version number of this release. For example "6.2.0". Always in the
  6. * format "major.minor.revision[.build]". The build part is optional. All of
  7. * major, minor, revision must be integers.
  8. */
  9. private static final String VERSION;
  10. /**
  11. * Major version number. For example 6 in 6.2.0.
  12. */
  13. private static final int VERSION_MAJOR;
  14. /**
  15. * Minor version number. For example 2 in 6.2.0.
  16. */
  17. private static final int VERSION_MINOR;
  18. /**
  19. * Version revision number. For example 0 in 6.2.0.
  20. */
  21. private static final int VERSION_REVISION;
  22. /**
  23. * Build identifier. For example "nightly-20091123-c9963" in
  24. * 6.2.0.nightly-20091123-c9963.
  25. */
  26. private static final String VERSION_BUILD;
  27. /* Initialize version numbers from string replaced by build-script. */
  28. static {
  29. if ("@VERSION@".equals("@" + "VERSION" + "@")) {
  30. VERSION = "9.9.9.INTERNAL-DEBUG-BUILD";
  31. } else {
  32. VERSION = "@VERSION@";
  33. }
  34. final String[] digits = VERSION.split("\\.", 4);
  35. VERSION_MAJOR = Integer.parseInt(digits[0]);
  36. VERSION_MINOR = Integer.parseInt(digits[1]);
  37. VERSION_REVISION = Integer.parseInt(digits[2]);
  38. if (digits.length == 4) {
  39. VERSION_BUILD = digits[3];
  40. } else {
  41. VERSION_BUILD = "";
  42. }
  43. }
  44. public static String getFullVersion() {
  45. return VERSION;
  46. }
  47. public static int getMajorVersion() {
  48. return VERSION_MAJOR;
  49. }
  50. public static int getMinorVersion() {
  51. return VERSION_MINOR;
  52. }
  53. public static int getRevision() {
  54. return VERSION_REVISION;
  55. }
  56. public static String getBuildIdentifier() {
  57. return VERSION_BUILD;
  58. }
  59. }