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

com.softicar.platform.common.core.java.classpath.JavaClasspathRootFilter Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy