1 11 package org.jivesoftware.util; 12 13 18 public class Version { 19 20 23 private int major; 24 25 28 private int minor; 29 30 33 private int micro; 34 35 38 private int statusVersion; 39 40 43 private ReleaseStatus status; 44 45 48 private String versionString; 49 50 58 public Version(int major, int minor, int micro, ReleaseStatus status, int statusVersion) { 59 this.major = major; 60 this.minor = minor; 61 this.micro = micro; 62 this.status = status; 63 this.statusVersion = statusVersion; 64 if (status != null) { 65 if (status == ReleaseStatus.Release) { 66 versionString = major + "." + minor + "." + micro; 67 } 68 else { 69 if (statusVersion >= 0) { 70 versionString = major + "." + minor + "." + micro + " " + status.toString() + 71 " " + statusVersion; 72 } 73 else { 74 versionString = major + "." + minor + "." + micro + " " + status.toString(); 75 } 76 } 77 } 78 else { 79 versionString = major + "." + minor + "." + micro; 80 } 81 } 82 83 89 public String getVersionString() { 90 return versionString; 91 } 92 93 98 public ReleaseStatus getStatus() { 99 return status; 100 } 101 102 107 public int getMajor() { 108 return major; 109 } 110 111 116 public int getMinor() { 117 return minor; 118 } 119 120 125 public int getMicro() { 126 return micro; 127 } 128 129 136 public int getStatusVersion() { 137 return statusVersion; 138 } 139 140 144 public enum ReleaseStatus { 145 Release, Release_Candidate, Beta, Alpha; 146 } 147 } 148 | Popular Tags |