1 19 20 package org.netbeans.modules.debugger.jpda.models; 21 22 import com.sun.jdi.ObjectReference; 23 import com.sun.jdi.PrimitiveValue; 24 import com.sun.jdi.Value; 25 import com.sun.jdi.VoidValue; 26 27 import org.netbeans.api.debugger.jpda.ReturnVariable; 28 29 import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl; 30 31 35 public class ReturnVariableImpl extends AbstractVariable implements ReturnVariable { 36 37 private String methodName; 38 39 40 public ReturnVariableImpl( 41 JPDADebuggerImpl debugger, 42 Value returnValue, 43 String parentID, 44 String methodName 45 ) { 46 super ( 47 debugger, 48 returnValue, 49 parentID + ".return " + methodName + "=" + getStringValue(returnValue) ); 51 this.methodName = methodName; 52 } 53 54 private static String getStringValue(Value v) { 55 if (v == null) return "null"; 56 if (v instanceof VoidValue) return "void"; 57 if (v instanceof PrimitiveValue) return v.toString (); 58 else return "#" + ((ObjectReference) v).uniqueID (); 59 } 60 61 public String methodName() { 62 return methodName; 63 } 64 65 public ReturnVariableImpl clone() { 66 return new ReturnVariableImpl( 67 getDebugger(), 68 getJDIValue(), 69 getID().substring(0, getID().length() - ".return".length()), 70 methodName); 71 } 72 73 public String toString () { 74 return "ReturnVariable " + getValue(); 75 } 76 77 } 78 | Popular Tags |