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

com.dragome.commons.compiler.classpath.Classpath Maven / Gradle / Ivy

The newest version!
package com.dragome.commons.compiler.classpath;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

import com.dragome.commons.compiler.PrioritySolver;

public class Classpath
{
	private List entries= new ArrayList();

	public Classpath()
	{
	}

	public Classpath(ClasspathEntry entry)
	{
		entries.add(entry);
	}

	public void addEntry(String classPathEntry)
	{
		if (classPathEntry.contains(".jar"))
			entries.add(JarClasspathEntry.createFromPath(classPathEntry));
		else
			entries.add(FolderClasspathEntry.createFromPath(classPathEntry));
	}

	public List getEntries()
	{
		return entries;
	}

	public String toString()
	{
		return J7Helper.join(";", entries.toArray());
	}

	public void setEntries(ClasspathEntry[] entries)
	{
		this.entries= Arrays.asList(entries);
	}

	public void sortClassPath(Comparator comparator)
	{
		J7Helper.sort(entries, comparator);
	}

	public void sortByPriority(final PrioritySolver prioritySolver)
	{
		sortClassPath(new Comparator()
		{
			public int compare(ClasspathEntry o1, ClasspathEntry o2)
			{
				return prioritySolver.getPriorityOf(o2) - prioritySolver.getPriorityOf(o1);
			}
		});
	}

	public void addEntries(List extraClasspath)
	{
		entries.addAll(extraClasspath);
	}

	//	if (!file.exists())
	//	{
	//		DragomeJsCompiler.errorCount++;
	//		Log.getLogger().error("Cannot find resource on class path: " + file.getAbsolutePath());
	//		continue;
	//	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy