net.grinder.util.weave.j2se6
Class ASMTransformerFactory

java.lang.Object
  extended by net.grinder.util.weave.j2se6.ASMTransformerFactory
All Implemented Interfaces:
DCRWeaver.ClassFileTransformerFactory

public final class ASMTransformerFactory
extends Object
implements DCRWeaver.ClassFileTransformerFactory

DCRWeaver.ClassFileTransformerFactory implementation that uses ASM to advise methods.

Author:
Philip Aston

Constructor Summary
ASMTransformerFactory(Class<?> adviceClass)
          Constructor.
 
Method Summary
 ClassFileTransformer create(net.grinder.util.weave.j2se6.PointCutRegistry pointCutRegistry)
          Factory method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASMTransformerFactory

public ASMTransformerFactory(Class<?> adviceClass)
                      throws WeavingException
Constructor.

We can't add fields to the class due to DCR limitations, so we have to wire in the advice class using static methods.adviceClass should implement two methods with the following names and signatures.

 public static void enter(Object reference,
                          String location);

 public static void exit(Object reference,
                         String location,
                         boolean success);
 

Parameters:
adviceClass - Class that provides the advice.
Throws:
WeavingException - If adviceClass does not implement enter and exit static methods.
Method Detail

create

public ClassFileTransformer create(net.grinder.util.weave.j2se6.PointCutRegistry pointCutRegistry)
Factory method.

Specified by:
create in interface DCRWeaver.ClassFileTransformerFactory
Parameters:
pointCutRegistry - The point cut registry.
Returns:
The transformer.


Copyright © 2000-2013. All Rights Reserved.