org.apache.openjpa.enhance
Class ClassRedefiner

java.lang.Object
  extended by org.apache.openjpa.enhance.ClassRedefiner

public class ClassRedefiner
extends Object

Redefines the method bodies of existing classes. Supports Java 5 VMs that have a javaagent installed on the command line as well as newer VMs without any javaagent flag.

Since:
1.0.0

Constructor Summary
ClassRedefiner()
           
 
Method Summary
static boolean canRedefineClasses()
           
static void redefineClasses(OpenJPAConfiguration conf, Map<Class,byte[]> classes)
          For each element in classes, this method will redefine all the element's methods such that field accesses are intercepted in-line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassRedefiner

public ClassRedefiner()
Method Detail

redefineClasses

public static void redefineClasses(OpenJPAConfiguration conf,
                                   Map<Class,byte[]> classes)
For each element in classes, this method will redefine all the element's methods such that field accesses are intercepted in-line. If canRedefineClasses() returns false, this method is a no-op.


canRedefineClasses

public static boolean canRedefineClasses()
Returns:
whether or not this VM has an instrumentation installed that permits redefinition of classes. This assumes that all the arguments will be modifiable classes according to java.lang.instrument.Instrumentation#isModifiableClass, and only checks whether or not an instrumentation is available and if retransformation is possible.


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.