package test;
import alt.jiapi.event.FieldEventProducer;
import alt.jiapi.event.FieldListener;
import alt.jiapi.event.FieldEvent;
import alt.jiapi.*;
/**
* This class is mainly used to test Jiapi event model.
* In addition to that, it servers as an example to using
* Jiapi event model.
*/
public class FieldEventTest extends InstrumentorTest implements FieldListener {
public static void main(String [] args) throws Exception {
FieldEventTest ft = new FieldEventTest();
ft.run(args);
}
public FieldEventTest() throws JiapiException {
InstrumentationDescriptor id = new InstrumentationDescriptor();
ctx.addInstrumentationDescriptor(id);
addInclusionRules(id, getInclusionRules());
addExclusionRules(id, getExclusionRules());
FieldEventProducer fep =
new FieldEventProducer(id, System.getProperty("resolution", "*"));
fep.addFieldListener(this);
}
// --- Interface FieldListener ---
public void fieldGet(FieldEvent event) {
System.out.println("Field get : " + event);
}
public void fieldSet(FieldEvent event) {
System.out.println("Field set : " + event);
}
public void fieldChanging(FieldEvent event) {
System.out.println("Field changing : " + event);
}
// Default test case name
public String defaultClassName() {
return "test.GetSet";
}
}