aQute.bnd.build.model.conversions.RequirementFormatter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biz.aQute.bndlib Show documentation
Show all versions of biz.aQute.bndlib Show documentation
bndlib: A Swiss Army Knife for OSGi
package aQute.bnd.build.model.conversions;
import java.util.Map.Entry;
import org.osgi.resource.Requirement;
public class RequirementFormatter implements Converter {
public String convert(Requirement req) throws IllegalArgumentException {
StringBuilder builder = new StringBuilder();
builder.append(req.getNamespace());
for (Entry directive : req.getDirectives().entrySet()) {
builder.append(';').append(directive.getKey()).append(":='").append(directive.getValue()).append('\'');
}
for (Entry attribute : req.getAttributes().entrySet()) {
builder.append(';').append(attribute.getKey()).append("='").append(attribute.getValue()).append('\'');
}
return builder.toString();
}
@Override
public String error(String msg) {
return msg;
}
}