public class VersionInfo extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<VersionInfo>
Modifier and Type | Field and Description |
---|---|
private int |
buildNumber |
private int |
majorVersion |
private int |
minorVersion |
private int |
release |
private static long |
serialVersionUID |
Constructor and Description |
---|
VersionInfo(int major,
int minor) |
VersionInfo(int major,
int minor,
int release,
int build) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(VersionInfo o) |
boolean |
equals(java.lang.Object obj) |
int |
getBuildNumber() |
int |
getMajorVersion() |
int |
getMinorVersion() |
int |
getRelease() |
int |
hashCode() |
static VersionInfo |
parse(java.lang.String version)
Parses a version string - assumed to contain at most 4 non-negative components separated by a '.'.
|
java.lang.String |
toString() |
private static final long serialVersionUID
private final int majorVersion
private final int minorVersion
private final int release
private final int buildNumber
public VersionInfo(int major, int minor)
public VersionInfo(int major, int minor, int release, int build)
public final int getMajorVersion()
public final int getMinorVersion()
public final int getRelease()
public final int getBuildNumber()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(VersionInfo o)
compareTo
in interface java.lang.Comparable<VersionInfo>
public java.lang.String toString()
toString
in class java.lang.Object
public static VersionInfo parse(java.lang.String version) throws java.lang.NumberFormatException
version
- The version string - ignored if null
/emptyVersionInfo
- or null
if empty inputjava.lang.NumberFormatException
- If failed to parse any of the componentsjava.lang.IllegalArgumentException
- If any of the parsed components is negative