KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > debugger > jpda > models > ObjectFieldVariable


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.debugger.jpda.models;
21
22 import com.sun.jdi.ClassNotLoadedException;
23 import com.sun.jdi.Field;
24 import com.sun.jdi.InvalidTypeException;
25 import com.sun.jdi.ObjectReference;
26 import com.sun.jdi.Value;
27 import org.netbeans.api.debugger.jpda.InvalidExpressionException;
28 import org.netbeans.api.debugger.jpda.ObjectVariable;
29 import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
30
31
32 /**
33  * @author Jan Jancura
34  */

35 class ObjectFieldVariable extends FieldVariable
36 implements ObjectVariable {
37
38
39     private ObjectReference objectReference;
40     private String JavaDoc genericSignature;
41     
42     ObjectFieldVariable (
43         JPDADebuggerImpl debugger,
44         ObjectReference value,
45         //String className,
46
Field field,
47         String JavaDoc parentID,
48         String JavaDoc genericSignature,
49         ObjectReference objectReference
50     ) {
51         super (
52             debugger,
53             value,
54            // className,
55
field,
56             parentID,
57             genericSignature
58         );
59         this.objectReference = objectReference;
60         this.genericSignature = genericSignature;
61     }
62
63     protected void setValue (Value value) throws InvalidExpressionException {
64         try {
65             objectReference.setValue (field, value);
66         } catch (InvalidTypeException ex) {
67             throw new InvalidExpressionException (ex);
68         } catch (ClassNotLoadedException ex) {
69             throw new InvalidExpressionException (ex);
70         }
71     }
72
73     public ObjectFieldVariable clone() {
74         return new ObjectFieldVariable(getDebugger(), (ObjectReference) getJDIValue(),
75                 field, getID(), genericSignature, objectReference);
76     }
77
78     
79     // other methods ...........................................................
80

81     public String JavaDoc toString () {
82         return "ObjectFieldVariable " + field.name ();
83     }
84 }
85
Popular Tags