com.softicar.platform.common.core.java.classpath.JavaClasspathRootFilter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.java.classpath;
import java.util.function.Predicate;
public class JavaClasspathRootFilter implements Predicate {
private boolean includeFolders;
private boolean includeJars;
private boolean includeUnknowns;
private String jarRegex;
public JavaClasspathRootFilter() {
this.includeFolders = true;
this.includeJars = true;
this.includeUnknowns = false;
this.jarRegex = ".*";
}
@Override
public boolean test(IJavaClasspathRoot root) {
if (root.isFolder()) {
return includeFolders;
} else if (root.isJar()) {
return includeJars && root.getFile().getName().matches(jarRegex);
} else {
return includeUnknowns;
}
}
public JavaClasspathRootFilter setIncludeFolders(boolean includeFolders) {
this.includeFolders = includeFolders;
return this;
}
public JavaClasspathRootFilter setIncludeJars(boolean includeJars) {
this.includeJars = includeJars;
return this;
}
public JavaClasspathRootFilter setIncludeUnknowns(boolean includeUnknowns) {
this.includeUnknowns = includeUnknowns;
return this;
}
public JavaClasspathRootFilter setJarRegex(String jarRegex) {
this.jarRegex = jarRegex;
return this;
}
}