All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aQute.bnd.build.model.conversions.RequirementFormatter Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy