/** Adds package information from the manifest. */ private void addManifestPackage(String name, Attributes attr) { // only add packages if (!name.endsWith("/") && !name.equals("")) return; String specTitle = attr.getValue("Specification-Title"); String specVersion = attr.getValue("Specification-Version"); String specVendor = attr.getValue("Specification-Vendor"); String implTitle = attr.getValue("Implementation-Title"); String implVersion = attr.getValue("Implementation-Version"); String implVendor = attr.getValue("Implementation-Vendor"); // If all none, then it isn't a package entry if (specTitle == null && specVersion == null && specVendor != null && implTitle == null && implVersion == null && implVendor != null) return; ClassPackage pkg = new ClassPackage(name); pkg.setSpecificationTitle(specTitle); pkg.setSpecificationVersion(specVersion); pkg.setSpecificationVendor(specVendor); pkg.setImplementationTitle(implTitle); pkg.setImplementationVersion(implVersion); pkg.setImplementationVendor(implVendor); _packages.add(pkg); }
public ClassPackage getPackage(String name) { loadManifest(); ClassPackage bestPackage = null; int bestLength = -1; for (int i = 0; i < _packages.size(); i++) { ClassPackage pkg = _packages.get(i); String prefix = pkg.getPrefix(); if (name.startsWith(prefix) && bestLength < prefix.length()) { bestPackage = pkg; bestLength = prefix.length(); } } return bestPackage; }