hmi.elckerlyc
Class Info

java.lang.Object
  extended by hmi.elckerlyc.Info

public class Info
extends Object

The Info class is intended to be used as "Main class" when the package is jarred. Running java -jar will print some package information. Note that some of this information is only available from the Manifest.mf file, that is included in the jar file, and not when running directly from compiled classes.


Field Summary
private static Package pack
           
private static String packageName
           
 
Constructor Summary
Info()
           
 
Method Summary
static String getVersion()
          Returns the specification version from the Manifest.mf file, if available, or else an empty String.
static boolean isCompatibleWith(String desiredVersion)
          checks whether the package specification version is compatible with a certain desired version.
static boolean isRunningFromJar()
          Returns true iff we are running from a jar file, with manifest and specification version included.
static void main(String[] arg)
           
static String manifestInfo()
          Yields a String containing manifest file info.
static void requireVersion(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
 

Field Detail

pack

private static Package pack

packageName

private static String packageName
Constructor Detail

Info

public Info()
Method Detail

manifestInfo

public static String manifestInfo()
Yields a String containing manifest file info. When not running from a jar file, only the package name is included.


requireVersion

public static void requireVersion(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()
Returns the specification version from the Manifest.mf file, if available, or else an empty String.


isCompatibleWith

public static boolean isCompatibleWith(String desiredVersion)
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.


isRunningFromJar

public static boolean isRunningFromJar()
Returns true iff we are running from a jar file, with manifest and specification version included.


main

public static void main(String[] arg)