1 package test; 2 3 import alt.jiapi.event.FieldEventProducer; 4 import alt.jiapi.event.FieldListener; 5 import alt.jiapi.event.FieldEvent; 6 import alt.jiapi.*; 7 8 13 public class FieldEventTest extends InstrumentorTest implements FieldListener { 14 public static void main(String [] args) throws Exception { 15 FieldEventTest ft = new FieldEventTest(); 16 ft.run(args); 17 } 18 19 public FieldEventTest() throws JiapiException { 20 InstrumentationDescriptor id = new InstrumentationDescriptor(); 21 ctx.addInstrumentationDescriptor(id); 22 23 addInclusionRules(id, getInclusionRules()); 24 addExclusionRules(id, getExclusionRules()); 25 26 FieldEventProducer fep = 27 new FieldEventProducer(id, System.getProperty("resolution", "*")); 28 29 fep.addFieldListener(this); 30 } 31 32 public void fieldGet(FieldEvent event) { 34 System.out.println("Field get : " + event); 35 } 36 37 public void fieldSet(FieldEvent event) { 38 System.out.println("Field set : " + event); 39 } 40 41 public void fieldChanging(FieldEvent event) { 42 System.out.println("Field changing : " + event); 43 } 44 45 46 public String defaultClassName() { 48 return "test.GetSet"; 49 } 50 } 51 | Popular Tags |