com.dragome.commons.compiler.classpath.VirtualFolderClasspathEntry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-js-commons Show documentation
Show all versions of dragome-js-commons Show documentation
Dragome SDK module: commons
The newest version!
package com.dragome.commons.compiler.classpath;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.jar.JarOutputStream;
import com.dragome.commons.compiler.CopyUtils;
public class VirtualFolderClasspathEntry implements ClasspathEntry
{
private List classpathFiles;
public VirtualFolderClasspathEntry(List classpathFiles)
{
this.classpathFiles= classpathFiles;
}
public ClasspathFile getClasspathFileOf(String relativeName)
{
for (ClasspathFile compilableFile : classpathFiles)
if (compilableFile.getPath().equals(relativeName))
return compilableFile;
return null;
}
public List getAllFilesNamesFiltering(ClasspathFileFilter classpathFilter)
{
List files= new ArrayList();
for (ClasspathFile classpathFile : classpathFiles)
{
File file= new File(classpathFile.getPath());
if (classpathFilter == null || classpathFilter.accept(file, new File(".")))
files.add(classpathFile.getPath().replace(".class", ""));
}
return files;
}
public void copyFilesToJar(JarOutputStream jos)
{
for (ClasspathFile classpathFile : classpathFiles)
CopyUtils.addEntryToJar(jos, classpathFile.openInputStream(), classpathFile.getFilename().replace(".class", ""));
}
public String getName()
{
return "virtual-folder-classpath-entry";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy