|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nite.util.VersionChecker
public class VersionChecker
A flexible java version checker that can take different actions for different versions. The default is to warn (on STDERR) if the Java version is less than 1.4.2_05 and to quit with an error message on STDOUT if the Java version is less than 1.4. But you can set the threshholds and make it pop messages on-screen if preferred. Note: depends on alphanumeric String comparison - I think that's valid.. Typical use:
VersionChecker vc = new VersionChecker(); int vres = vc.checkVersion(); if (vres==VersionChecker.VERSION_ERROR) { System.exit(1); }
Field Summary | |
---|---|
static int |
VERSION_ERROR
|
static int |
VERSION_OK
|
static int |
VERSION_WARNING
|
Constructor Summary | |
---|---|
VersionChecker()
This constructor uses all the defaults: warn (on STDERR) if the Java version is less than 1.4.2_05 and popup an on-screen error message if the Java version is less than 1.4. |
|
VersionChecker(java.lang.String cut,
java.lang.String warn,
boolean cutmessage,
boolean warnmessage)
This constructor takes user-values for cutoff and warnings: cut is the version number under which an error is reported; warn is the version number below which a warning is reported; cutmessage is true if you want error messages on-screen (false for STDERR); warnmessage is true if you want warninng messages on-screen (false for STDERR). |
Method Summary | |
---|---|
int |
checkVersion()
check version compared to System version string: popup any warning / cutoff and return VERSION_OK, VERSION_WARNING or VERSION_ERROR so the client program can decide what to do about it |
int |
checkVersion(java.lang.String version)
check version from given Version string: popup any warning / cutoff and return VERSION_OK, VERSION_WARNING or VERSION_ERROR so the client program can decide what to do about it |
void |
setCutoffMessageOnScreen(boolean val)
set to true to see any failure mesage as a popup; false for STDERR. |
void |
setCutoffThreshhold(java.lang.String val)
Set the cutoff threshold (as a string like '1.4.2_05' or similar). |
void |
setWarningMessageOnScreen(boolean val)
set to true to see any warning mesage as a popup; false for STDERR. |
void |
setWarningThreshhold(java.lang.String val)
Set the warning threshold (as a string like '1.4.2_06' or similar). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VERSION_OK
public static final int VERSION_WARNING
public static final int VERSION_ERROR
Constructor Detail |
---|
public VersionChecker()
public VersionChecker(java.lang.String cut, java.lang.String warn, boolean cutmessage, boolean warnmessage)
Method Detail |
---|
public int checkVersion(java.lang.String version)
public int checkVersion()
public void setCutoffMessageOnScreen(boolean val)
public void setWarningMessageOnScreen(boolean val)
public void setCutoffThreshhold(java.lang.String val)
public void setWarningThreshhold(java.lang.String val)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |