/** * Check whether a given application version is compatible with the version of JHotDraw currently * loaded in the Java VM. A version number is available if there is a corresponding version entry * in the JHotDraw jar file for the framework package. */ public static boolean isCompatibleVersion(String compareVersionString) { // Package pack = VersionManagement.class.getPackage(); Package pack = packages[4]; if (compareVersionString == null) { return pack.getSpecificationVersion() == null; } else { return pack.isCompatibleWith(compareVersionString); } }
public static String getPackageVersion(final Package lookupPackage) { if (lookupPackage == null) { return null; } String specVersion = lookupPackage.getSpecificationVersion(); if (specVersion != null) { return specVersion; } else { // search in parent package String normalizedPackageName = normalizePackageName(lookupPackage.getName()); String nextPackageName = getNextPackage(normalizedPackageName); return getPackageVersion(Package.getPackage(nextPackageName)); } }
/** * Return the version of the main package of the framework. A version number is available if there * is a corresponding version entry in the JHotDraw jar file for the framework package. */ public static String getJHotDrawVersion() { // look for the framework main package Package pack = packages[4]; return pack.getSpecificationVersion(); }