public class UrlSet extends Object
Use with ClassFinder to filter the Urls to be scanned, example:
UrlSet urlSet = new UrlSet(classLoader); urlSet = urlSet.exclude(ClassLoader.getSystemClassLoader().getParent()); urlSet = urlSet.excludeJavaExtDirs(); urlSet = urlSet.excludeJavaEndorsedDirs(); urlSet = urlSet.excludeJavaHome(); urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", "")); urlSet = urlSet.exclude(".*?/JavaVM.framework/.*"); urlSet = urlSet.exclude(".*?/activemq-(core|ra)-[\\d.]+.jar(!/)?");
Modifier and Type | Class and Description |
---|---|
static interface |
UrlSet.FileProtocolNormalizer |
Constructor and Description |
---|
UrlSet(ClassLoaderInterface classLoader) |
UrlSet(ClassLoaderInterface classLoader,
Set<String> protocols) |
UrlSet(Collection<URL> urls)
Ignores all URLs that are not "jar" or "file"
|
UrlSet(URL... urls) |
Modifier and Type | Method and Description |
---|---|
UrlSet |
exclude(ClassLoaderInterface parent) |
UrlSet |
exclude(File file) |
UrlSet |
exclude(String pattern) |
UrlSet |
exclude(UrlSet urlSet) |
UrlSet |
excludeJavaEndorsedDirs()
Calls excludePaths(System.getProperty("java.endorsed.dirs"))
|
UrlSet |
excludeJavaExtDirs()
Calls excludePaths(System.getProperty("java.ext.dirs"))
|
UrlSet |
excludeJavaHome() |
UrlSet |
excludePaths(String pathString) |
UrlSet |
excludeUserExtensionsDir()
Calls excludePaths(System.getProperty("java.ext.dirs"))
|
List<URL> |
getUrls() |
UrlSet |
include(UrlSet urlSet) |
UrlSet |
includeClassesUrl(ClassLoaderInterface classLoaderInterface,
UrlSet.FileProtocolNormalizer normalizer)
Try to find a classes directory inside a war file add its normalized url to this set
|
UrlSet |
matching(String pattern) |
UrlSet |
relative(File file) |
public UrlSet(ClassLoaderInterface classLoader) throws IOException
IOException
public UrlSet(ClassLoaderInterface classLoader, Set<String> protocols) throws IOException
IOException
public UrlSet(URL... urls)
public UrlSet(Collection<URL> urls)
urls
- collection of URLspublic UrlSet exclude(ClassLoaderInterface parent) throws IOException
IOException
public UrlSet exclude(File file) throws MalformedURLException
MalformedURLException
public UrlSet exclude(String pattern) throws MalformedURLException
MalformedURLException
public UrlSet excludeJavaExtDirs() throws MalformedURLException
MalformedURLException
- in case if incorrect URLpublic UrlSet excludeJavaEndorsedDirs() throws MalformedURLException
MalformedURLException
- in case if incorrect URLpublic UrlSet excludeUserExtensionsDir() throws MalformedURLException
MalformedURLException
- in case if incorrect URLpublic UrlSet excludeJavaHome() throws MalformedURLException
MalformedURLException
public UrlSet excludePaths(String pathString) throws MalformedURLException
MalformedURLException
public UrlSet includeClassesUrl(ClassLoaderInterface classLoaderInterface, UrlSet.FileProtocolNormalizer normalizer) throws IOException
classLoaderInterface
- class loader interfacenormalizer
- file protocol normalizerIOException
- in case of IO errorspublic UrlSet relative(File file) throws MalformedURLException
MalformedURLException
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.