it.imolinfo.jbi4cics.jbi
Class BCELClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by it.imolinfo.jbi4cics.jbi.BCELClassLoader

public final class BCELClassLoader
extends java.lang.ClassLoader

A class loader implementation able to receive class definition that will be found and defined on request.

Author:
Raffaele Spazzoli, Marco Cimatti

Constructor Summary
BCELClassLoader(java.lang.ClassLoader parent)
          Creates a new class loader using the specified parent class loader for delegation.
 
Method Summary
 void addClass(java.lang.String className, byte[] bytecode)
          Adds a new class data to this class loader.
protected  java.lang.Class<?> findClass(java.lang.String name)
          Finds the class with the specified binary name, searching in the pool of classes added by the addClass(String, byte[]) method.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, 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

BCELClassLoader

public BCELClassLoader(java.lang.ClassLoader parent)
Creates a new class loader using the specified parent class loader for delegation.

Parameters:
parent - the parent class loader.
Method Detail

addClass

public void addClass(java.lang.String className,
                     byte[] bytecode)
Adds a new class data to this class loader. After a call to this method, this class loader is able to find and define the new specified class, if parameters are valid.

Parameters:
className - the complete class name. Must be not null.
bytecode - the bytecode of the new class. Must be not null and it is considered all its content, starting from offset 0 and ending at offset bytecode.length - 1. It is recommended that the caller doesn't modify its content, because this array is cached as is, without cloning it.

findClass

protected java.lang.Class<?> findClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException
Finds the class with the specified binary name, searching in the pool of classes added by the addClass(String, byte[]) method.

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
name - the binary name of the class.
Returns:
the resulting Class object.
Throws:
java.lang.ClassNotFoundException - if the class could not be found, because it's not been added to this class loader.
See Also:
addClass(String, byte[])


Copyright © 2005-2008 Imola Informatica. All Rights Reserved.