Interface Classpath
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Classpath
Classpath abstraction. PMD's symbol resolver uses the classpath to find class files.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static ClasspathcontextClasspath()default ClasspathdelegateTo(Classpath c)default Classpathexclude(Set<String> deletedEntries)Return a classpath that will ignore the given classpath entries, even if they are present in this classpath.@Nullable URLfindResource(String resourcePath)Returns a URL to load the given resource if it exists in this classpath.static ClasspathforClassLoader(ClassLoader classLoader)Returns a classpath instance that usesClassLoader.getResource(String)to find resources.
-
-
-
Method Detail
-
findResource
@Nullable URL findResource(String resourcePath)
Returns a URL to load the given resource if it exists in this classpath. Otherwise returns null. This will typically be used to find Java class files. A typical input would bejava/lang/String.class.- Parameters:
resourcePath- Resource path, as described inClassLoader.getResource(String)- Returns:
- A URL if the resource exists, otherwise null
-
exclude
default Classpath exclude(Set<String> deletedEntries)
Return a classpath that will ignore the given classpath entries, even if they are present in this classpath. Every call tofindResource(String)is otherwise delegated to this one.- Parameters:
deletedEntries- Set of resource paths to exclude
-
forClassLoader
static Classpath forClassLoader(ClassLoader classLoader)
Returns a classpath instance that usesClassLoader.getResource(String)to find resources.
-
contextClasspath
static Classpath contextClasspath()
-
-