Package org.eclipse.sisu.space
Class URLClassSpace
java.lang.Object
org.eclipse.sisu.space.URLClassSpace
- All Implemented Interfaces:
ClassSpace
- Direct Known Subclasses:
CloningClassSpace
-
Constructor Summary
ConstructorsConstructorDescriptionURLClassSpace
(ClassLoader loader) Creates aClassSpace
backed by aClassLoader
and its default class path.URLClassSpace
(ClassLoader loader, URL[] path) Creates aClassSpace
backed by aClassLoader
with a restricted class path. -
Method Summary
Modifier and TypeMethodDescriptionfinal DeferredClass
<?> deferLoadClass
(String name) Defers loading of the named class from the surrounding class space.final boolean
final Enumeration
<URL> findEntries
(String path, String glob, boolean recurse) Queries local class space content for entries matching the given pattern.final URL
getResource
(String name) Queries the surrounding class space for the resource with the given name.final Enumeration
<URL> getResources
(String name) Queries the surrounding class space for all resources with the given name.final URL[]
getURLs()
final int
hashCode()
final Class
<?> Loads the named class from the surrounding class space.final String
toString()
-
Constructor Details
-
URLClassSpace
Creates aClassSpace
backed by aClassLoader
and its default class path.For
URLClassLoader
s this is their expanded Class-Path; otherwise it is empty.- Parameters:
loader
- The class loader to use when getting/finding resources
-
URLClassSpace
Creates aClassSpace
backed by aClassLoader
with a restricted class path.- Parameters:
loader
- The class loader to use when getting resourcespath
- The class path to use when finding resources- See Also:
-
-
Method Details
-
loadClass
Description copied from interface:ClassSpace
Loads the named class from the surrounding class space.- Specified by:
loadClass
in interfaceClassSpace
- Parameters:
name
- The class name- Returns:
- Class instance
- See Also:
-
deferLoadClass
Description copied from interface:ClassSpace
Defers loading of the named class from the surrounding class space.- Specified by:
deferLoadClass
in interfaceClassSpace
- Parameters:
name
- The class name- Returns:
- Deferred class
- See Also:
-
getResource
Description copied from interface:ClassSpace
Queries the surrounding class space for the resource with the given name.- Specified by:
getResource
in interfaceClassSpace
- Parameters:
name
- The resource name- Returns:
- URL pointing to the resource;
null
if it wasn't found - See Also:
-
getResources
Description copied from interface:ClassSpace
Queries the surrounding class space for all resources with the given name.- Specified by:
getResources
in interfaceClassSpace
- Parameters:
name
- The resource name- Returns:
- Sequence of URLs, one for each matching resource
- See Also:
-
findEntries
Description copied from interface:ClassSpace
Queries local class space content for entries matching the given pattern.- Specified by:
findEntries
in interfaceClassSpace
- Parameters:
path
- The initial search directory; for example"META-INF"
glob
- The filename glob pattern; for example"*.xml"
recurse
- Iftrue
recurse into sub-directories; otherwise only search initial directory- Returns:
- Sequence of URLs, one for each matching entry
- See Also:
-
getURLs
-
hashCode
public final int hashCode() -
equals
-
toString
-