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

org.bndtools.builder.BndFileModel Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2010 Neil Bartlett.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Neil Bartlett - initial API and implementation
 *******************************************************************************/
package org.bndtools.builder;

import java.util.Collection;
import java.util.Set;
import java.util.regex.Matcher;

import org.eclipse.core.runtime.IPath;

import aQute.bnd.osgi.Instruction;

public class BndFileModel {

    private final IPath path;
    private IPath targetPath;
    private Set includes;
    private Collection classpath;

    public BndFileModel(IPath path) {
        this.path = path;
    }

    public IPath getTargetPath() {
        return targetPath;
    }

    public void setTargetPath(IPath targetPath) {
        this.targetPath = targetPath;
    }

    public IPath getPath() {
        return path;
    }

    public void setIncludes(Set includes) {
        this.includes = includes;
    }

    public boolean containsPackage(String packageName) {
        for (Instruction instruction : includes) {
            Matcher matcher = instruction.getMatcher(packageName);

            if (matcher.matches())
                return true;
        }
        return false;
    }

    public boolean containsAny(Collection affectedPackages) {
        for (Instruction instruction : includes) {
            for (String pkg : affectedPackages) {
                Matcher matcher = instruction.getMatcher(pkg);

                if (matcher.matches())
                    return true;
            }
        }
        return false;
    }

    public Collection getClasspath() {
        return classpath;
    }

    public void setClasspath(Collection classpath) {
        this.classpath = classpath;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy