001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.api.debugger.jpda;
043:
044: import java.util.List;
045:
046: /**
047: * Represents instance of some object in debugged JVM. This interface can
048: * be optionally inplemented by a implementation of {@link LocalVariable} or
049: * {@link Field} interfaces.
050: *
051: * <pre style="background-color: rgb(255, 255, 102);">
052: * Since JDI interfaces evolve from one version to another, it's strongly recommended
053: * not to implement this interface in client code. New methods can be added to
054: * this interface at any time to keep up with the JDI functionality.</pre>
055: *
056: * @see LocalVariable
057: * @see Field
058: * @see This
059: * @see Super
060: * @see JPDAThread#getContendedMonitor
061: * @see JPDAThread#getOwnedMonitors
062: *
063: * @author Jan Jancura
064: */
065: public interface ObjectVariable extends Variable {
066:
067: /**
068: * Calls {@link java.lang.Object#toString} in debugged JVM and returns
069: * its value.
070: *
071: * @return toString () value of this instance
072: */
073: public abstract String getToStringValue()
074: throws InvalidExpressionException;
075:
076: /**
077: * Calls given method in debugged JVM on this instance and returns
078: * its value.
079: *
080: * @param methodName a name of method to be called
081: * @param signature a signature of method to be called
082: * @param arguments a arguments to be used
083: *
084: * @return value of given method call on this instance
085: */
086: public abstract Variable invokeMethod(String methodName,
087: String signature, Variable[] arguments)
088: throws NoSuchMethodException, InvalidExpressionException;
089:
090: /**
091: * Number of fields defined in this object.
092: *
093: * @return number of fields defined in this object
094: */
095: public abstract int getFieldsCount();
096:
097: /**
098: * Returns field defined in this object.
099: *
100: * @param name a name of field to be returned
101: *
102: * @return field defined in this object
103: */
104: public abstract Field getField(String name);
105:
106: /**
107: * Returns non static fields defined in this object.
108: *
109: * @param from the index of first field to be returned
110: * @param to the index of last field, exclusive
111: *
112: * @return fields defined in this object that are greater then or equal to
113: * <code>from</code> index and less then <code>to</code> index.
114: */
115: public abstract Field[] getFields(int from, int to);
116:
117: /**
118: * Return all static fields.
119: *
120: * @return all static fields
121: */
122: public abstract Field[] getAllStaticFields(int from, int to);
123:
124: /**
125: * Return all inherited fields.
126: *
127: * @return all inherited fields
128: */
129: public abstract Field[] getInheritedFields(int from, int to);
130:
131: /**
132: * Returns variables that directly reference this variable.
133: * Use {@link JPDADebugger#canGetInstanceInfo} to determine if this operation is supported.
134: * @param maxReferrers The maximum number of referring variables to return. Must be non-negative. If zero, all referring variables are returned.
135: * @return A list of referring variables.
136: */
137: List<ObjectVariable> getReferringObjects(long maxReferrers)
138: throws UnsupportedOperationException;
139:
140: /**
141: * Returns representation of super class of this object.
142: *
143: * @return representation of super class of this object
144: */
145: public abstract Super getSuper();
146:
147: /**
148: * Get the run-time class type of this object variable.
149: * @return The variable class type.
150: */
151: JPDAClassType getClassType();
152:
153: /**
154: * Returns a unique identifier for this object variable.
155: * It is guaranteed to be unique among all object variables from the same debuggee that have not yet been disposed.
156: * @return a long unique ID
157: */
158: long getUniqueID();
159: }
|