Qwylt

java.lang.module
Class ClassSpace

java.lang.Object
  extended by java.lang.module.ResourceSpace
      extended by java.lang.module.ClassSpace
Direct Known Subclasses:
ImportSpace, Module

public abstract class ClassSpace
extends ResourceSpace

This class represents an accessor for a set of classes and resources that may be either locally defined, retrieved from delegate ClassSpaces, or both.

Since:
Dec 30, 2008
Author:
Bryan Atsatt

Constructor Summary
ClassSpace()
           
 
Method Summary
static java.lang.String getPackageName(java.lang.String className)
          Returns the package name from the specified class name.
abstract  ClassSpace getPackageProvider(java.lang.String packageName)
          Returns the ClassSpace that provides the specified package.
abstract  java.util.List<ModuleArchive> getServiceProviders(java.lang.String serviceName)
          Returns the ModuleArchives that provide the specified service.
abstract  java.lang.Class<?> loadClass(java.lang.String className)
          Loads the exported class with the specified name.
abstract  java.lang.Class<?> loadLocalClass(java.lang.String className, java.lang.String packageName)
          Loads the exported class with the specified name without delegating to other providers.
 
Methods inherited from class java.lang.module.ResourceSpace
equals, getExportedPackages, getImportedPackages, getName, getResource, getResourceData, getResourcePackageName, getResources, getVersion, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassSpace

public ClassSpace()
Method Detail

getPackageName

public static java.lang.String getPackageName(java.lang.String className)
Returns the package name from the specified class name.

Parameters:
className - The class name.
Returns:
The '.' separated package name.

getPackageProvider

public abstract ClassSpace getPackageProvider(java.lang.String packageName)
Returns the ClassSpace that provides the specified package.

Specified by:
getPackageProvider in class ResourceSpace
Parameters:
packageName - The package name.
Returns:
The provider, which may be this instance, or null if package is not exported.

getServiceProviders

public abstract java.util.List<ModuleArchive> getServiceProviders(java.lang.String serviceName)
Returns the ModuleArchives that provide the specified service.

Parameters:
serviceName - The service interface class name.
Returns:
The providers, empty if none.

loadClass

public abstract java.lang.Class<?> loadClass(java.lang.String className)
                                      throws java.lang.ClassNotFoundException
Loads the exported class with the specified name.

Parameters:
className - The binary name of the class to be loaded.
Returns:
The resulting Class object.
Throws:
java.lang.ClassNotFoundException - If the class was not found.

loadLocalClass

public abstract java.lang.Class<?> loadLocalClass(java.lang.String className,
                                                  java.lang.String packageName)
                                           throws java.lang.ClassNotFoundException
Loads the exported class with the specified name without delegating to other providers.

Parameters:
className - The binary name of the class to be loaded.
packageName - The package name of the class to be loaded, "" if none.
Returns:
The resulting Class object.
Throws:
java.lang.ClassNotFoundException - If the class was not found.

Qwylt

Send comments or questions to Bryan Atsatt