Interface ClassPathElement
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractClassPathElement,DirectoryClassPathElement,FilteredClassPathElement,JarClassPathElement,MemoryClassPathElement,PathTreeClassPathElement
public interface ClassPathElement extends Closeable
Represents an element on the virtual classpath, such as a jar file or classes directory.
-
-
Field Summary
Fields Modifier and Type Field Description static ClassPathElementEMPTY
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> Tapply(Function<OpenPathTree,T> func)Processes the content of this classpath element and returns a result.static ClassPathElementfromDependency(ResolvedDependency dep)static ClassPathElementfromPath(Path path, boolean runtime)Creates an element from a file system pathdefault ArtifactKeygetDependencyKey()If this classpath element represents a Maven artifact, the method will return its key, otherwise - null.ManifestgetManifest()ProtectionDomaingetProtectionDomain()Set<String>getProvidedResources()Returns a set of all known resources.ClassPathResourcegetResource(String name)Loads a resource from the class path element, or null if it does not exist.PathgetRoot()booleanisRuntime()Checks whether this is a runtime classpath element
-
-
-
Field Detail
-
EMPTY
static final ClassPathElement EMPTY
-
-
Method Detail
-
getDependencyKey
default ArtifactKey getDependencyKey()
If this classpath element represents a Maven artifact, the method will return its key, otherwise - null.- Returns:
- the key of the Maven artifact this classpath element represents or null, in case this element does not represent any Maven artifact
-
getRoot
Path getRoot()
- Returns:
- The element root, or null if not applicable
-
apply
<T> T apply(Function<OpenPathTree,T> func)
Processes the content of this classpath element and returns a result.- Type Parameters:
T- result type- Parameters:
func- content processing function- Returns:
- processing result
-
getResource
ClassPathResource getResource(String name)
Loads a resource from the class path element, or null if it does not exist.- Parameters:
name- The resource to load- Returns:
- An representation of the class path resource if it exists
-
getProvidedResources
Set<String> getProvidedResources()
Returns a set of all known resources.- Returns:
- A set representing all known resources
-
getProtectionDomain
ProtectionDomain getProtectionDomain()
- Returns:
- The protection domain that should be used to define classes from this element
-
getManifest
Manifest getManifest()
-
isRuntime
boolean isRuntime()
Checks whether this is a runtime classpath element- Returns:
- true in case this is a runtime classpath element, otherwise - false
-
fromPath
static ClassPathElement fromPath(Path path, boolean runtime)
Creates an element from a file system path
-
fromDependency
static ClassPathElement fromDependency(ResolvedDependency dep)
-
-