public final class URLClassSpace extends Object implements ClassSpace
Constructor and Description |
---|
URLClassSpace(ClassLoader loader)
Creates a
ClassSpace backed by a ClassLoader and its default class path. |
URLClassSpace(ClassLoader loader,
URL[] path)
Creates a
ClassSpace backed by a ClassLoader with a restricted class path. |
Modifier and Type | Method and Description |
---|---|
DeferredClass<?> |
deferLoadClass(String name)
Defers loading of the named class from the surrounding class space.
|
boolean |
equals(Object rhs) |
Enumeration<URL> |
findEntries(String path,
String glob,
boolean recurse)
Queries local class space content for entries matching the given pattern.
|
URL |
getResource(String name)
Queries the surrounding class space for the resource with the given name.
|
Enumeration<URL> |
getResources(String name)
Queries the surrounding class space for all resources with the given name.
|
URL[] |
getURLs() |
int |
hashCode() |
Class<?> |
loadClass(String name)
Loads the named class from the surrounding class space.
|
String |
toString() |
public URLClassSpace(ClassLoader loader)
ClassSpace
backed by a ClassLoader
and its default class path.
For URLClassLoader
s this is their expanded Class-Path; otherwise it is empty.
loader
- The class loader to use when getting/finding resourcespublic URLClassSpace(ClassLoader loader, URL[] path)
ClassSpace
backed by a ClassLoader
with a restricted class path.loader
- The class loader to use when getting resourcespath
- The class path to use when finding resourcesgetResources(String)
,
findEntries(String, String, boolean)
public Class<?> loadClass(String name)
ClassSpace
loadClass
in interface ClassSpace
name
- The class nameClassLoader.loadClass(String)
public DeferredClass<?> deferLoadClass(String name)
ClassSpace
deferLoadClass
in interface ClassSpace
name
- The class nameClassLoader.loadClass(String)
public URL getResource(String name)
ClassSpace
getResource
in interface ClassSpace
name
- The resource namenull
if it wasn't foundClassLoader.getResource(String)
public Enumeration<URL> getResources(String name)
ClassSpace
getResources
in interface ClassSpace
name
- The resource nameClassLoader.getResources(String)
public Enumeration<URL> findEntries(String path, String glob, boolean recurse)
ClassSpace
findEntries
in interface ClassSpace
path
- The initial search directory; for example "META-INF"
glob
- The filename glob pattern; for example "*.xml"
recurse
- If true
recurse into sub-directories; otherwise only search initial directoryBundle.findEntries(String, String, boolean)
public URL[] getURLs()
Copyright © 2010-2014 Sonatype, Inc.. All Rights Reserved.