1 6 7 package fr.emn.info.eaop.event; 8 9 import java.util.*; 10 import java.lang.reflect.*; 11 import java.io.*; 12 13 19 public class ConstructorReturn extends Event { 20 21 public Object receiver; 22 public Constructor constructor; 23 public Object [] args; 24 public int stackLevel; 25 26 public ConstructorReturn(Thread thread, Object returnValue, 27 Object receiver, Constructor constructor, Object [] args) { 28 super(thread); 29 this.receiver = receiver; 30 this.constructor = constructor; 31 this.args = args; 32 this.stackLevel = 0; 35 StringWriter stringWriter = new StringWriter(); 36 PrintWriter printWriter = new PrintWriter(stringWriter, true); 37 new Exception ().printStackTrace(printWriter); 38 String string = stringWriter.toString(); 39 int pos = 0; 40 while ((pos = string.indexOf('\n', pos + 1)) > -1) { 41 this.stackLevel++; 42 } 43 } 44 45 public String toString() { 46 String result = "ConstructorReturn "; 47 result += this.toString2(); 48 return result; 49 } 50 51 public String toString2() { 52 String result = receiver + "." + constructor.getName() + "("; 53 54 for (int i=0; i<args.length; i++) { 55 result += args[i] + ","; 56 } 57 58 result += ")"; 59 result += super.toString(); 60 return result; 61 } 62 } 63 | Popular Tags |