List<ExportedPackage> packageExports = new ArrayList<ExportedPackage>();
for (String exportedPackage : partial.getExportedPackages()) {
HeaderDeclaration declaration = findMostSpecificDeclaration(exportTemplateDeclarations, exportedPackage);
ExportedPackage export = result.getExportPackage().addExportedPackage(exportedPackage);
if (declaration != null) {
export.getAttributes().putAll(declaration.getAttributes());
Map<String, String> directives = declaration.getDirectives();
addCommaSeparated(export.getExclude(), directives.get("excluded"));
addCommaSeparated(export.getInclude(), directives.get("include"));
addCommaSeparated(export.getMandatory(), directives.get("mandatory"));
addCommaSeparated(export.getUses(), directives.get("uses"));
}
Set<String> uses = partial.getUses(exportedPackage);
export.getUses().addAll(uses);
String version = resolveVersion(declaration, bundleVersion);
if (StringUtils.hasText(version)) {
export.getAttributes().put("version", version);
}
packageExports.add(export);
}
}