|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.system.Version
public class Version
A software version identifier.
This follows the more-or-less classic form of major.minor.release (e.g. 1.2.3). In general major versions indicate substantial platform changes, generally with incompatibilities between them. Minor versions indicate branches of the software. Often odd numbers are used to indicate unstable branches, while even numbers indicate stable branches. The release number is incremented for each release.
Note that these aren't ordinary decimal numbers. They are independent integers separated by periods. Thus versions are ordered 1.1, 1.2... 1.10, 1.11 - 1.1 is different from 1.10 and 1.2 comes before 1.19.
Missing pieces are represented by -1. This is only valid in the trailing versions - you can't have a version with no major version, and you can't have a version with major and release versions and no minor version.
A build property is also provided; this can store optional build or revision data.
There are a variety of interesting comparisons you can make between versions.
Copyright 2007 Partner Software, Inc.
| Constructor Summary | |
|---|---|
Version(int major)
Creates a new version with the given major version, no minor or release versions. |
|
Version(int major,
int minor)
Creates a new version with the given major version, minor version, and no release version. |
|
Version(int major,
int minor,
int release)
Creates a new version with the given major, minor and release versions. |
|
Version(java.lang.String versionNumber)
Creates a version from the provided String. |
|
Version(java.lang.String versionNumber,
java.lang.String build)
Creates a version from the provided version and build strings. |
|
| Method Summary | |
|---|---|
int |
compareTo(Version nother)
|
boolean |
equals(java.lang.Object nother)
|
java.lang.String |
getBuild()
Returns the build info, which is an arbitrarily-formatted string. |
int |
getMajor()
Returns the major version number. |
int |
getMinor()
Returns the minor version number, or -1 if there is none. |
int |
getRelease()
Returns the release version number, or -1 if there is none. |
java.lang.String |
getVersionString()
Returns this version as a string in major.minor.release (e.g. |
int |
hashCode()
|
boolean |
majorMatches(Version nother)
Returns true if the version given matches this one's major version. |
boolean |
minorMatches(Version nother)
Returns true if the version given matches this one's major and minor versions. |
boolean |
releaseMatches(Version nother)
Returns true if the version given matches this one's major, minor, and release versions. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Version(java.lang.String versionNumber,
java.lang.String build)
public Version(java.lang.String versionNumber)
public Version(int major)
public Version(int major,
int minor)
public Version(int major,
int minor,
int release)
| Method Detail |
|---|
public boolean majorMatches(Version nother)
public boolean minorMatches(Version nother)
public boolean releaseMatches(Version nother)
public int compareTo(Version nother)
compareTo in interface java.lang.Comparable<Version>public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic java.lang.String getVersionString()
public int getMajor()
public int getMinor()
public int getRelease()
public java.lang.String getBuild()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||