KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > alt > jiapi > agent > Transformer


1 package alt.jiapi.agent;
2
3 import alt.jiapi.reflect.JiapiClass;
4
5 import java.util.Properties JavaDoc;
6
7 /**
8  * This class is Jiapi equivalent of
9  * <i>java.lang.instrument.ClassFileTransformer</i>.
10  */

11 public class Transformer {
12
13     /**
14      * Initialize Transformer with given properties.
15      */

16     public void init(Properties JavaDoc p) {
17     }
18
19     /**
20      * Transform given JiapiClass. This method should do whatever
21      * bytecode manipulation is needed. If no bytecode is modified,
22      * this method should return false. This signals agent, that
23      * bytecode has not changed.<p>
24      * This method is called for the class, if a class is being loaded
25      * into JVM for the first time.
26      *
27      * @return true, if bytecode has changed. Default is to return false.
28      */

29     public boolean transform(JiapiClass clazz) {
30     return false;
31     }
32
33     /**
34      * Retransform given JiapiClass. This method should do whatever
35      * bytecode manipulation is needed. If no bytecode is modified,
36      * this method should return false. This signals agent, that
37      * bytecode has not changed.<p>
38      * Retransforming a class indicates, that a class has been
39      * loaded into JVM already. By modifying a class, a class reloading
40      * should occur in JVM.
41      *
42      * @return true, if bytecode has changed. Default is to return false.
43      */

44     public boolean retransform(JiapiClass clazz) {
45     return false;
46     }
47 }
48
Popular Tags