org.norther.tammi.acorn.net
Class URLClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.norther.tammi.acorn.net.URLClassLoader
Direct Known Subclasses:
AbstractLoader

public class URLClassLoader
extends URLClassLoader

Extends the standard URL class loader by providing assembly support for loading classes dynamically during run-time.

Version:
$Id: URLClassLoader.java,v 1.11 2009/11/04 09:09:23 cvsimp Exp $
Author:
Ilkka Priha

Constructor Summary
URLClassLoader()
          Contructs a new loader.
URLClassLoader(ClassLoader parent)
          Constructs a loader with a parent.
URLClassLoader(URL[] urls)
          Contructs a new loader with URLs.
URLClassLoader(URL[] urls, ClassLoader parent)
          Constructs a loader with URLs and a parent.
URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
          Constructs a loader with URLs, a parent and a stream handler factory.
 
Method Summary
 Class<?> defineClass(String name, org.objectweb.asm.ClassWriter cw)
          Defines a class by assembling it from the class writer.
<T> Class<? extends T>
defineSubclass(String name, Class<T> clazz, Class<?>... ifaces)
          Defines a subclass for a class with all super constructors.
<T> Class<? extends T>
defineSubclass(String name, Class<T> clazz, short access, Class<?>... ifaces)
          Defines a subclass for a class with all super constructors but modified access flags.
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, 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

URLClassLoader

public URLClassLoader()
Contructs a new loader.


URLClassLoader

public URLClassLoader(ClassLoader parent)
Constructs a loader with a parent.

Parameters:
parent - the parent class loader.

URLClassLoader

public URLClassLoader(URL[] urls)
Contructs a new loader with URLs.

Parameters:
urls - an array of URLs.

URLClassLoader

public URLClassLoader(URL[] urls,
                      ClassLoader parent)
Constructs a loader with URLs and a parent.

Parameters:
urls - an array of URLs.
parent - the parent class loader.

URLClassLoader

public URLClassLoader(URL[] urls,
                      ClassLoader parent,
                      URLStreamHandlerFactory factory)
Constructs a loader with URLs, a parent and a stream handler factory.

Parameters:
urls - an array of URLs.
parent - the parent class loader.
factory - the stream handler factory.
Method Detail

defineClass

public Class<?> defineClass(String name,
                            org.objectweb.asm.ClassWriter cw)
                     throws ClassFormatError
Defines a class by assembling it from the class writer.

Parameters:
name - the name of the class, or null if not known.
cw - the class writer.
Returns:
the defined class.
Throws:
ClassFormatError - if the definition is invalid.

defineSubclass

public <T> Class<? extends T> defineSubclass(String name,
                                             Class<T> clazz,
                                             Class<?>... ifaces)
                                  throws ClassFormatError
Defines a subclass for a class with all super constructors.

Type Parameters:
T - the superclass type.
Parameters:
name - the name of the class.
clazz - the superclass.
ifaces - optional interfaces.
Returns:
the defined class.
Throws:
ClassFormatError - if the definition is invalid.

defineSubclass

public <T> Class<? extends T> defineSubclass(String name,
                                             Class<T> clazz,
                                             short access,
                                             Class<?>... ifaces)
                                  throws ClassFormatError
Defines a subclass for a class with all super constructors but modified access flags.

Type Parameters:
T - the superclass type.
Parameters:
name - the name of the class.
clazz - the superclass.
access - access flags.
ifaces - optional interfaces.
Returns:
the defined class.
Throws:
ClassFormatError - if the definition is invalid.


Copyright © 2004 The Norther Organization. All rights reserved.