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

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

The newest version!
package aQute.bnd.build.model.conversions;

import org.osgi.resource.Requirement;

import aQute.bnd.build.model.clauses.HeaderClause;
import aQute.bnd.osgi.resource.CapReqBuilder;

public class RequirementListConverter extends HeaderClauseListConverter {

	public RequirementListConverter() {
		super(new Converter() {
			@Override
			public Requirement convert(HeaderClause input) {
				if (input == null)
					return null;
				try {
					CapReqBuilder builder = CapReqBuilder.createCapReqBuilder(input.getName(), input.getAttribs());
					return builder.buildSyntheticRequirement();
				} catch (Exception e) {
					throw new IllegalArgumentException(e);
				}
			}

			@Override
			public Requirement error(String msg) {
				CapReqBuilder builder = new CapReqBuilder(msg);
				return builder.buildSyntheticRequirement();
			}
		});
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy