de.smartics.analysis.javadoc.runtime
Class AbstractProjectClassLoader

Package class diagram package AbstractProjectClassLoader
java.lang.Object
  extended by java.lang.ClassLoader
      extended by de.smartics.analysis.javadoc.runtime.AbstractProjectClassLoader
Direct Known Subclasses:
ProjectClassLoader

public abstract class AbstractProjectClassLoader
     
     
extends ClassLoader

Base implementation of class loaders that serve classes from the given directories.

Author:
Robert Reiner

Constructor Summary
protected AbstractProjectClassLoader(ClassLoader parent)
          Default constructor.
 
Method Summary
protected  void ensurePackageProvided(String className)
          Ensures that the package of a class specified by the given name is already defined.
protected  Class<?> loadClassFile(String className, File classFile)
          Loads the class.
protected  Class<?> loadClassFromLibrary(String className, String fileName, File dirName)
          Opens a reader to the class file within the archive.
protected  URL loadResourceFromLibrary(String resourceName, String fileName, File dirName)
          Opens a reader to the resource file within the archive.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProjectClassLoader

protected AbstractProjectClassLoader(ClassLoader parent)
Default constructor.

Parameters:
parent - the parent class loader.
Method Detail

ensurePackageProvided

protected void ensurePackageProvided(String className)
Ensures that the package of a class specified by the given name is already defined. If it is not defined the loaded class instance will not have a package reference.

Parameters:
className - the name of the class whose package is to check to be already defined.

loadClassFile

protected Class<?> loadClassFile(String className,
                                 File classFile)
                          throws ClassNotFoundException
Loads the class. Ensures that the package of the class is defined.

Parameters:
className - the name of the class.
classFile - the file with the binary data.
Returns:
the loaded class definition.
Throws:
ClassNotFoundException - if the class cannot be loaded.

loadClassFromLibrary

protected Class<?> loadClassFromLibrary(String className,
                                        String fileName,
                                        File dirName)
                                 throws ClassNotFoundException
Opens a reader to the class file within the archive.

Parameters:
className - the name of the class to load.
fileName - the name of the class file to load.
dirName - the name of the directory the archive file is located.
Returns:
the reader to the source file for the given class in the archive.
Throws:
ClassNotFoundException - if the class cannot be found.

loadResourceFromLibrary

protected URL loadResourceFromLibrary(String resourceName,
                                      String fileName,
                                      File dirName)
                               throws IOException
Opens a reader to the resource file within the archive.

Parameters:
resourceName - the name of the resource to load.
fileName - the name of the resource file to load.
dirName - the name of the directory the archive file is located.
Returns:
the reader to the source file for the given class in the archive.
Throws:
ClassNotFoundException - if the class cannot be found.
IOException


Copyright © 2008-2011 Kronseder & Reiner GmbH - smartics. All Rights Reserved.