dynclass
Class ClassCreator

java.lang.Object
  |
  +--dynclass.ClassCreator

public class ClassCreator
extends Object

ClassCreator turns a ClassDefinition into a real-live Class. It also has utility methods for constructing instances of classes it creates.


Constructor Summary
ClassCreator()
           
 
Method Summary
static Class defineClass(ClassDefinition def)
          Create a Class from the given description.
static Object newInstance(Class cls, InvocationHandler impl)
          Create a new instance of the given class, which must have been created by ClassCreator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassCreator

public ClassCreator()
Method Detail

newInstance

public static Object newInstance(Class cls,
                                 InvocationHandler impl)
                          throws Exception
Create a new instance of the given class, which must have been created by ClassCreator. Method calls will be dispatched to the given InvocationHandler.

defineClass

public static Class defineClass(ClassDefinition def)
Create a Class from the given description. Recent definitions are cached, so if an equivalent ClassDefinition was provided recently then there is a good chance the same class will be returned.