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

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

Go to download

A command line utility and Ant plugin to wrap, build, or examine bundles.

There is a newer version: 2.4.0
Show newest version
package aQute.bnd.build.model.conversions;

import java.util.Map.Entry;

import org.osgi.resource.*;

import aQute.bnd.header.*;
import aQute.bnd.osgi.resource.*;
import aQute.libg.tuple.*;

public class RequirementListConverter extends ClauseListConverter {

	public RequirementListConverter() {
		super(new Converter>() {
			public Requirement convert(Pair input) throws IllegalArgumentException {
				if (input == null)
					return null;
				String namespace = input.getFirst();
				CapReqBuilder builder = new CapReqBuilder(namespace);
				for (Entry entry : input.getSecond().entrySet()) {
					String key = entry.getKey();
					if (key.endsWith(":")) {
						key = key.substring(0, key.length() - 1);
						builder.addDirective(key, entry.getValue());
					} else {
						builder.addAttribute(key, entry.getValue());
					}
				}
				return builder.buildSyntheticRequirement();
			}
		});
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy