public static ImportedPackage getImportedPackage(BundleManifest manifest, String packageName) { ImportedPackage result = null; for (ImportedPackage importedPackage : manifest.getImportPackage().getImportedPackages()) { if (importedPackage.getPackageName().equals(packageName)) { result = importedPackage; break; } } return result; }
public static List<ImportedPackage> getImportedPackages(Bundle bundle, Resolution resolution) { final List<ImportedPackage> result = new ArrayList<ImportedPackage>(); final BundleManifest manifest = BundleManifestFactory.createBundleManifest(bundle.getHeaders(), new DummyParserLogger()); for (ImportedPackage importedPackage : manifest.getImportPackage().getImportedPackages()) { if (resolution == null || resolution.equals(importedPackage.getResolution())) { result.add(importedPackage); } } return result; }