hmi.util
Class CheckVersion

java.lang.Object
  extended by hmi.util.CheckVersion

public final class CheckVersion
extends Object

Author:
zwiers

Constructor Summary
private CheckVersion()
           
 
Method Summary
static String getVersion(String packageName)
          Returns the specification version from the Manifest.mf file, if available, or else an empty String.
static boolean isCompatibleWith(String desiredVersion, String specificationVersion)
          checks whether the package specification version is compatible with a certain desired version.
static void requireVersion(String packageName, String requiredVersion)
          Checks whether the current specification version meets the specified required version; if not, a RuntimeException is thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckVersion

private CheckVersion()
Method Detail

requireVersion

public static void requireVersion(String packageName,
                                  String requiredVersion)
Checks whether the current specification version meets the specified required version; if not, a RuntimeException is thrown. No check is performed when manifest info is not available.


getVersion

public static String getVersion(String packageName)
Returns the specification version from the Manifest.mf file, if available, or else an empty String.


isCompatibleWith

public static boolean isCompatibleWith(String desiredVersion,
                                       String specificationVersion)
checks whether the package specification version is compatible with a certain desired version. "isCompatibleWith(desiredversion)" return true iff the desiredVersion is smaller or equal than the package specification version, where "smaller than" is determined by the lexicographic order on major, minor, and micro version numbers. (Missing numbers are considered to be 0). For instance, when the package specification version would be 2.1, then some examples of compatible desired versions are: 1, 1.0, 1.6, 2.0.4, 2.1, 2.1.0, whereas desired versions like 2.2, 3.0, or 2.1.1 would not be compatible.