org.jboss.byteman.rule.compiler
Class Compiler

java.lang.Object
  extended by org.jboss.byteman.rule.compiler.Compiler

public class Compiler
extends java.lang.Object

A class which compiles a rule by generating a subclass of the rule's helperClass which implements the HelperAdapter interface


Nested Class Summary
private static class Compiler.ClassbyteClassLoader
          this is a classloader used to define classes from bytecode
 
Field Summary
private static int nextId
           
 
Constructor Summary
Compiler()
           
 
Method Summary
private static byte[] compileBytes(Rule rule, java.lang.Class helperClass, java.lang.String helperName, java.lang.String compiledHelperName, boolean compileToBytecode)
           
static java.lang.Class getHelperAdapter(Rule rule, java.lang.Class helperClass, boolean compileToBytecode)
           
static java.lang.Class<?> loadHelperAdapter(java.lang.ClassLoader triggerClassLoader, java.lang.String helperAdapterName, byte[] classBytes)
          dynamically load and return a generated helper adapter classes using a custom classloader derived from the trigger class's loader
private static int nextId()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextId

private static int nextId
Constructor Detail

Compiler

public Compiler()
Method Detail

getHelperAdapter

public static java.lang.Class getHelperAdapter(Rule rule,
                                               java.lang.Class helperClass,
                                               boolean compileToBytecode)
                                        throws CompileException
Throws:
CompileException

compileBytes

private static byte[] compileBytes(Rule rule,
                                   java.lang.Class helperClass,
                                   java.lang.String helperName,
                                   java.lang.String compiledHelperName,
                                   boolean compileToBytecode)
                            throws java.lang.Exception
Throws:
java.lang.Exception

nextId

private static int nextId()

loadHelperAdapter

public static java.lang.Class<?> loadHelperAdapter(java.lang.ClassLoader triggerClassLoader,
                                                   java.lang.String helperAdapterName,
                                                   byte[] classBytes)
dynamically load and return a generated helper adapter classes using a custom classloader derived from the trigger class's loader

Parameters:
triggerClassLoader - the class loader of the trigger class which has been matched with this helper class's rule
helperAdapterName - the name of the helper adaptter class to be loaded
classBytes - the byte array defining the class
Returns: