NextApp Echo
App Container 1.0.5

nextapp.echoservlet.util
Class Version

java.lang.Object
  extended bynextapp.echoservlet.util.Version

public final class Version
extends java.lang.Object

Utility class for comparing version numbers in String format. This class may be used to determine if a version number is greater than another to make a hypothesis about whether the version is compatible with a requirement.


Constructor Summary
private Version()
          Non-instantiable class.
 
Method Summary
private static int getTokenValue(java.lang.String token)
          Returns a best guess translation of a string to an integer.
static boolean meetsRequirement(java.lang.String requiredVersion, java.lang.String testVersion)
          Tests to see if a version number meets or exceeds a requirement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Version

private Version()
Non-instantiable class.

Method Detail

meetsRequirement

public static final boolean meetsRequirement(java.lang.String requiredVersion,
                                             java.lang.String testVersion)
Tests to see if a version number meets or exceeds a requirement. For example, if version 1.4 is required, 1.4, 1.4.0, 1.4.1, 1.5, and 2.0 would meet the requirement. 0.7, 1, 1.0, 1.3, and 1.3.5 would not. Warning: At this time all versions must be numeric and separated by periods. Any deviation will result in .0 versions, such as 1.5.3b being calculated as 1.5.0.

Parameters:
requiredVersion - The version number that is required.
testVersion - The version number that is available.
Returns:
True if the tested version is equal to or higher than the requirement.

getTokenValue

private static final int getTokenValue(java.lang.String token)
Returns a best guess translation of a string to an integer. If the string is not numeric, zero is returned.

Parameters:
token - A string that may or may not contain a number.
Returns:
The string's value, forcibly converted into a number.

NextApp Echo
App Container 1.0.5