public class Version extends Object implements Comparable<Version>
Version identifiers have three components:
Two Versions are considered equal if all components are equal.
Constructor and Description |
---|
Version(int major,
int minor,
int build)
Instantiate a new Version from its component.
The standard format is Major.Minor.Build.Metamodel. |
Version(String versionString)
Instantiate a new Version from a String.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Version other) |
boolean |
equals(Object anObject)
Compares this Version to the specified object.
|
int |
getBuildVersion()
Get the build number of this version
|
int |
getMajorVersion()
Get the major number of this version.
|
int |
getMinorVersion()
Get the minor number of this version.
|
int |
hashCode() |
boolean |
isNewerThan(Version other)
Check if this Version is strictly newer than the given Version.
|
boolean |
isOlderThan(Version other)
Check if this Version is strictly older than the given Version.
|
String |
toString()
Provides a formatted string representation of the version.
|
String |
toString(String format)
Provides a formatted string representation of the version.
|
public Version(int major, int minor, int build)
major
- the first component of the version.minor
- the second component of the version.build
- the third component of the version.public Version(String versionString) throws NumberFormatException
versionString
- The String to parse to create the version.NumberFormatException
- thrown when the parameter doesn't have a valid format.public boolean equals(Object anObject)
The result is true if and only if the argument is not null and is a Version object that represents the same version object as this object.
Two Versions are considered equal if the only difference is one of their metamodel version being zero.
public int getBuildVersion()
public int getMajorVersion()
public int getMinorVersion()
public boolean isNewerThan(Version other)
Two Versions are considered equal if the only difference is one of their metamodel version being zero.
other
- the Version object that must be compared to this Version.public boolean isOlderThan(Version other)
Two Versions are considered equal if the only difference is one of their metamodel version being zero.
other
- the Version object that must be compared to this Version.public String toString()
The format is: V.R.CC.mmmm where:
public String toString(String format)
format
- The format is: VRCM where:
public int compareTo(Version other)
compareTo
in interface Comparable<Version>