1 22 23 package org.aspectj.debugger.request; 24 25 import com.sun.jdi.*; 26 import com.sun.jdi.event.*; 27 import org.aspectj.debugger.base.*; 28 29 public class ClassTextPrintingRequest extends TextPrintingRequest implements ClassListener { 30 31 public final static int PREPARE = 0x01; 32 public final static int UNLOAD = 0x10; 33 public final static int PREPARE_OR_UNLOAD = 0x11; 34 35 protected int mode; 36 protected String className; 37 38 public ClassTextPrintingRequest(Debugger debugger, String className, int mode, String text) { 39 super(debugger, text); 40 if (mode < PREPARE || mode > PREPARE_OR_UNLOAD) { 41 throw new IllegalArgumentException 42 ("mode:" + mode + " where " + PREPARE + "<=mode<=" + PREPARE_OR_UNLOAD); 43 } 44 this.mode = mode; 45 this.className = className; 46 } 47 48 public Object go() throws NoVMException, DebuggerException { 49 debugger.addClassListener(this); 50 return text; 51 } 52 53 public void classPrepareEvent(ClassPrepareEvent e) { 54 if ((mode & PREPARE) != 0 && e.referenceType().name().equals(className)) print(); 55 } 56 57 public void classUnloadEvent(ClassUnloadEvent e) { 58 if ((mode & UNLOAD) != 0 && e.className().equals(className)) print(); 59 } 60 } 61 | Popular Tags |