org.sonatype.guice.bean.reflect
Interface ClassSpace

All Known Implementing Classes:
BundleClassSpace, URLClassSpace

public interface ClassSpace

Represents an abstract collection of related classes and resources.


Method Summary
 DeferredClass<?> deferLoadClass(java.lang.String name)
          Defers loading of the named class from the surrounding class space.
 java.util.Enumeration<java.net.URL> findEntries(java.lang.String path, java.lang.String glob, boolean recurse)
          Queries local class space content for entries matching the given pattern.
 java.net.URL getResource(java.lang.String name)
          Queries the surrounding class space for the resource with the given name.
 java.util.Enumeration<java.net.URL> getResources(java.lang.String name)
          Queries the surrounding class space for all resources with the given name.
 java.lang.Class<?> loadClass(java.lang.String name)
          Loads the named class from the surrounding class space.
 

Method Detail

loadClass

java.lang.Class<?> loadClass(java.lang.String name)
                             throws java.lang.TypeNotPresentException
Loads the named class from the surrounding class space.

Parameters:
name - The class name
Returns:
Class instance
Throws:
java.lang.TypeNotPresentException
See Also:
ClassLoader.loadClass(String)

deferLoadClass

DeferredClass<?> deferLoadClass(java.lang.String name)
Defers loading of the named class from the surrounding class space.

Parameters:
name - The class name
Returns:
Deferred class
See Also:
ClassLoader.loadClass(String)

getResource

java.net.URL getResource(java.lang.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
See Also:
ClassLoader.getResource(String)

getResources

java.util.Enumeration<java.net.URL> getResources(java.lang.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
See Also:
ClassLoader.getResources(String)

findEntries

java.util.Enumeration<java.net.URL> findEntries(java.lang.String path,
                                                java.lang.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
See Also:
Bundle.findEntries(String, String, boolean)


Copyright © 2010-2011 Sonatype, Inc.. All Rights Reserved.