1 19 20 package org.netbeans.modules.debugger.jpda.models; 21 22 import com.sun.jdi.AbsentInformationException; 23 import com.sun.jdi.ObjectReference; 24 import com.sun.jdi.ReferenceType; 25 import com.sun.jdi.Value; 26 27 import java.util.ArrayList ; 28 import java.util.List ; 29 import java.util.logging.Level ; 30 import java.util.logging.Logger ; 31 32 import org.netbeans.api.debugger.jpda.ClassVariable; 33 import org.netbeans.api.debugger.jpda.Field; 34 import org.netbeans.api.debugger.jpda.JPDAClassType; 35 import org.netbeans.api.debugger.jpda.ObjectVariable; 36 37 import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl; 38 39 43 public class JPDAClassTypeImpl implements JPDAClassType { 44 45 private static final Logger loggerValue = Logger.getLogger("org.netbeans.modules.debugger.jpda.getValue"); 47 private JPDADebuggerImpl debugger; 48 private ReferenceType classType; 49 50 53 public JPDAClassTypeImpl(JPDADebuggerImpl debugger, ReferenceType classType) { 54 this.debugger = debugger; 55 this.classType = classType; 56 } 57 58 public String getName() { 59 return classType.name(); 60 } 61 62 public String getSourceName() throws AbsentInformationException { 63 return classType.sourceName(); 64 } 65 66 public ClassVariable classObject() { 67 return new ClassVariableImpl(debugger, classType.classObject(), ""); 68 } 69 70 public List <Field> staticFields() { 71 List <com.sun.jdi.Field> allFieldsOrig = classType.allFields(); 72 List <Field> staticFields = new ArrayList <Field>(); 73 for (int i = 0; i < allFieldsOrig.size(); i++) { 74 Value value = null; 75 com.sun.jdi.Field origField = allFieldsOrig.get(i); 76 if (origField.isStatic()) { 77 if (loggerValue.isLoggable(Level.FINE)) { 78 loggerValue.fine("STARTED : "+classType+".getValue("+origField+")"); 79 } 80 value = classType.getValue(origField); 81 if (loggerValue.isLoggable(Level.FINE)) { 82 loggerValue.fine("FINISHED: "+classType+".getValue("+origField+") = "+value); 83 } 84 staticFields.add(new FieldVariable(debugger, value, origField, "", (ObjectReference) null)); 85 } 86 } 87 return staticFields; 88 } 89 90 } 91 | Popular Tags |