public class

URLClassSpace

extends Object
implements ClassSpace
java.lang.Object
   ↳ org.eclipse.sisu.space.URLClassSpace
Known Direct Subclasses

Class Overview

ClassSpace backed by a strongly-referenced ClassLoader and a URL class path.

Summary

Public Constructors
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.
Public Methods
final DeferredClass<?> deferLoadClass(String name)
Defers loading of the named class from the surrounding class space.
final boolean equals(Object rhs)
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<?> loadClass(String name)
Loads the named class from the surrounding class space.
final String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.eclipse.sisu.space.ClassSpace

Public Constructors

public URLClassSpace (ClassLoader loader)

Creates a ClassSpace backed by a ClassLoader and its default class path.

For URLClassLoaders this is their expanded Class-Path; otherwise it is empty.

Parameters
loader The class loader to use when getting/finding resources

public URLClassSpace (ClassLoader loader, URL[] path)

Creates a ClassSpace backed by a ClassLoader with a restricted class path.

Parameters
loader The class loader to use when getting resources
path The class path to use when finding resources

Public Methods

public final DeferredClass<?> deferLoadClass (String name)

Defers loading of the named class from the surrounding class space.

Parameters
name The class name
Returns
  • Deferred class

public final boolean equals (Object rhs)

public final Enumeration<URL> findEntries (String path, String glob, boolean recurse)

Queries local class space content for entries matching the given pattern.

Parameters
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 directory
Returns
  • Sequence of URLs, one for each matching entry

public final URL getResource (String name)

Queries the surrounding class space for the resource with the given name.

Parameters
name The resource name
Returns
  • URL pointing to the resource; null if it wasn't found

public final Enumeration<URL> getResources (String name)

Queries the surrounding class space for all resources with the given name.

Parameters
name The resource name
Returns
  • Sequence of URLs, one for each matching resource

public final URL[] getURLs ()

public final int hashCode ()

public final Class<?> loadClass (String name)

Loads the named class from the surrounding class space.

Parameters
name The class name
Returns
  • Class instance

public final String toString ()