|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.townleyenterprises.common.Version
This class provides version information for the te-common project. It allows easy version checking from client user applications to enforce dependency checking on a particular release (if required).
Nested Class Summary | |
static class |
Version.VersionMismatchException
This exception is used to report version requirement failures. |
Field Summary | |
static java.lang.String |
BUILD
this is the sequential number of the official builds |
static java.lang.String |
DATE
this is the date on which the build was performed |
static int |
MAJOR
this is the major version number of the build |
static int |
MINOR
this is the minor version number of the build. |
static java.lang.String |
PROJECT
this is the project to which the version refers |
static java.lang.String |
RELEASE
this is the release number of the build in question |
Method Summary | |
static int |
compare(int maj1,
int min1,
java.lang.String rel1,
java.lang.String bld1,
int maj2,
int min2,
java.lang.String rel2,
java.lang.String bld2)
This utility method is used to compare two sets of version values and report how they relate to each other. |
static int |
compare(java.lang.String[] ver1,
java.lang.String[] ver2)
This version of compare deals with arrays of 4 string values (as parsed by the parse method) instead of the 8 string values. |
static int |
compare(java.lang.String verstr1,
java.lang.String verstr2)
This version of compare deals with two version strings which are expected to be in the format provided by either getVersion() or getFullVersion() . |
static java.lang.String |
getBuild()
This method is used to just retrieve the build portion of the version number. |
static java.lang.String |
getFullVersion()
This method is used to retrieve the formatted version number suitable for displaying in about boxes, version outputs, log files, etc. |
static java.lang.String |
getVersion()
This method is used to just get the formatted version number without the build information. |
static void |
main(java.lang.String[] args)
|
static java.lang.String[] |
parse(java.lang.String verstr)
This method is used to parse the supplied string into an array of String objects representing the version in the format: major.minor.release (Build
build[; date]) . |
static void |
require(int rmaj,
int rmin,
int rrel,
int rbuild)
This method is used to require the specific minimum version of the library be available. |
static void |
require(java.lang.String checkver)
This is an overloaded version of require which facilitates easier version checking. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PROJECT
public static final int MAJOR
public static final int MINOR
public static final java.lang.String RELEASE
public static final java.lang.String BUILD
public static final java.lang.String DATE
Method Detail |
public static java.lang.String getFullVersion()
public static java.lang.String getVersion()
public static java.lang.String getBuild()
public static void require(int rmaj, int rmin, int rrel, int rbuild) throws Version.VersionMismatchException
In this case, newer means
numerically later with the special exception of DEVELOPER
builds, which will automatically always succeed. For
prerelease builds, the -pre#
suffix should be
omitted and the build number should be used instead.
rmaj
- the required major versionrmin
- the required minor versionrrel
- the required release numberrbuild
- the required build number
Version.VersionMismatchException
- if the requested version is not available
java.lang.NumberFormatException
- if the required numeric values can't be converted to
numberspublic static void require(java.lang.String checkver) throws Version.VersionMismatchException
checkver
- the version of the required build
Version.VersionMismatchException
- if the requested version is not available
java.lang.NumberFormatException
- if the required numeric values can't be converted to
numberspublic static int compare(int maj1, int min1, java.lang.String rel1, java.lang.String bld1, int maj2, int min2, java.lang.String rel2, java.lang.String bld2)
DEVELOPER
, that version will always be greater
than the other.
maj1
- the fist major versionmin1
- the fist minor versionrel1
- the fist release numberbld1
- the fist build numbermaj2
- the fist major versionmin2
- the fist minor versionrel2
- the fist release numberbld2
- the fist build number
public static int compare(java.lang.String[] ver1, java.lang.String[] ver2)
ver1
- the string array for version 1ver2
- the string array for version 2
public static int compare(java.lang.String verstr1, java.lang.String verstr2)
getVersion()
or getFullVersion()
.
verstr1
- the first version stringverstr2
- the second version string
public static java.lang.String[] parse(java.lang.String verstr)
major.minor.release (Build
build[; date])
. If it doesn't
match this format,
an empty array is returned.
verstr
- the version string
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |