001: /*
002: * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.jdi;
027:
028: /**
029: * The mirror for a value in the target VM.
030: * This interface is the root of a
031: * value hierarchy encompassing primitive values and object values.
032: * <P>
033: * Some examples of where values may be accessed:
034: * <BLOCKQUOTE><TABLE SUMMARY="layout">
035: * <TR>
036: * <TD>{@link ObjectReference#getValue(com.sun.jdi.Field)
037: * ObjectReference.getValue(Field)}
038: * <TD>- value of a field
039: * <TR>
040: * <TD>{@link StackFrame#getValue(com.sun.jdi.LocalVariable)
041: * StackFrame.getValue(LocalVariable)}
042: * <TD>- value of a variable
043: * <TR>
044: * <TD>{@link VirtualMachine#mirrorOf(double)
045: * VirtualMachine.mirrorOf(double)}
046: * <TD>- created in the target VM by the JDI client
047: * <TR>
048: * <TD>{@link com.sun.jdi.event.ModificationWatchpointEvent#valueToBe()
049: * ModificationWatchpointEvent.valueToBe()}
050: * <TD>- returned with an event
051: * </TABLE></BLOCKQUOTE>
052: * <P>
053: * The following table illustrates which subinterfaces of Value
054: * are used to mirror values in the target VM --
055: * <TABLE BORDER=1 SUMMARY="Maps each kind of value to a mirrored
056: * instance of a subinterface of Value">
057: * <TR BGCOLOR="#EEEEFF">
058: * <TH id="primval" colspan=4>Subinterfaces of {@link PrimitiveValue}</TH>
059: * <TR BGCOLOR="#EEEEFF">
060: * <TH id="kind" align="left">Kind of value</TH>
061: * <TH id="example" align="left">For example -<br>expression in target</TH>
062: * <TH id="mirrored" align="left">Is mirrored as an<br>instance of</TH>
063: * <TH id="type" align="left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
064: * <TR>
065: * <TD headers="primval kind"> a boolean</TD>
066: * <TD headers="primval example"> <CODE>true</CODE></TD>
067: * <TD headers="primval mirrored"> {@link BooleanValue}</TD>
068: * <TD headers="primval type"> {@link BooleanType}</TD>
069: * <TR>
070: * <TD headers="primval kind"> a byte</TD>
071: * <TD headers="primval example"> <CODE>(byte)4</CODE></TD>
072: * <TD headers="primval mirrored"> {@link ByteValue}</TD>
073: * <TD headers="primval type"> {@link ByteType}</TD>
074: * <TR>
075: * <TD headers="primval kind"> a char</TD>
076: * <TD headers="primval example"> <CODE>'a'</CODE></TD>
077: * <TD headers="primval mirrored"> {@link CharValue}</TD>
078: * <TD headers="primval type"> {@link CharType}</TD>
079: * <TR>
080: * <TD headers="primval kind"> a double</TD>
081: * <TD headers="primval example"> <CODE>3.1415926</CODE></TD>
082: * <TD headers="primval mirrored"> {@link DoubleValue}</TD>
083: * <TD headers="primval type"> {@link DoubleType}</TD>
084: * <TR>
085: * <TD headers="primval kind"> a float</TD>
086: * <TD headers="primval example"> <CODE>2.5f</CODE></TD>
087: * <TD headers="primval mirrored"> {@link FloatValue}</TD>
088: * <TD headers="primval type"> {@link FloatType}</TD>
089: * <TR>
090: * <TD headers="primval kind"> an int</TD>
091: * <TD headers="primval example"> <CODE>22</CODE></TD>
092: * <TD headers="primval mirrored"> {@link IntegerValue}</TD>
093: * <TD headers="primval type"> {@link IntegerType}</TD>
094: * <TR>
095: * <TD headers="primval kind"> a long</TD>
096: * <TD headers="primval example"> <CODE>1024L</CODE></TD>
097: * <TD headers="primval mirrored"> {@link LongValue}</TD>
098: * <TD headers="primval type"> {@link LongType}</TD>
099: * <TR>
100: * <TD headers="primval kind"> a short</TD>
101: * <TD headers="primval example"> <CODE>(short)12</CODE></TD>
102: * <TD headers="primval mirrored"> {@link ShortValue}</TD>
103: * <TD headers="primval type"> {@link ShortType}</TD>
104: * <TR>
105: * <TD headers="primval kind"> a void</TD>
106: * <TD headers="primval example"> <CODE> </CODE></TD>
107: * <TD headers="primval mirrored"> {@link VoidValue}</TD>
108: * <TD headers="primval type"> {@link VoidType}</TD>
109: * <TR BGCOLOR="#EEEEFF">
110: * <TH id="objref" colspan=4>Subinterfaces of {@link ObjectReference}</TH>
111: * <TR BGCOLOR="#EEEEFF">
112: * <TH id="kind2" align="left">Kind of value</TH>
113: * <TH id="example2" align="left">For example -<br>expression in target</TH>
114: * <TH id="mirrored2" align="left">Is mirrored as an<br>instance of</TH>
115: * <TH id="type2" align="left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
116: * <TR>
117: * <TD headers="objref kind2"> a class instance</TD>
118: * <TD headers="objref example2"> <CODE>this</CODE></TD>
119: * <TD headers="objref mirrored2"> {@link ObjectReference}</TD>
120: * <TD headers="objref type2"> {@link ClassType}</TD>
121: * <TR>
122: * <TD headers="objref kind2"> an array</TD>
123: * <TD headers="objref example2"> <CODE>new int[5]</CODE></TD>
124: * <TD headers="objref mirrored2"> {@link ArrayReference}</TD>
125: * <TD headers="objref type2"> {@link ArrayType}</TD>
126: * <TR>
127: * <TD headers="objref kind2"> a string</TD>
128: * <TD headers="objref example2"> <CODE>"hello"</CODE></TD>
129: * <TD headers="objref mirrored2"> {@link StringReference}</TD>
130: * <TD headers="objref type2"> {@link ClassType}</TD>
131: * <TR>
132: * <TD headers="objref kind2"> a thread</TD>
133: * <TD headers="objref example2"> <CODE>Thread.currentThread()</CODE></TD>
134: * <TD headers="objref mirrored2"> {@link ThreadReference}</TD>
135: * <TD headers="objref type2"> {@link ClassType}</TD>
136: * <TR>
137: * <TD headers="objref kind2"> a thread group</TD>
138: * <TD headers="objref example2"> <CODE>Thread.currentThread()<br> .getThreadGroup()</CODE></TD>
139: * <TD headers="objref mirrored2"> {@link ThreadGroupReference}</TD>
140: * <TD headers="objref type2"> {@link ClassType}</TD>
141: * <TR>
142: * <TD headers="objref kind2"> a <CODE>java.lang.Class</CODE><br>instance</TD>
143: * <TD headers="objref example2"> <CODE>this.getClass()</CODE></TD>
144: * <TD headers="objref mirrored2"> {@link ClassObjectReference}</TD>
145: * <TD headers="objref type2"> {@link ClassType}</TD>
146: * <TR>
147: * <TD headers="objref kind2"> a class loader</TD>
148: * <TD headers="objref example2"> <CODE>this.getClass()<br> .getClassLoader() </CODE></TD>
149: * <TD headers="objref mirrored2"> {@link ClassLoaderReference}</TD>
150: * <TD headers="objref type2"> {@link ClassType}</TD>
151: * <TR BGCOLOR="#EEEEFF">
152: * <TH id="other" colspan=4>Other</TH>
153: * <TR BGCOLOR="#EEEEFF">
154: * <TH id="kind3" align="left">Kind of value</TD>
155: * <TH id="example3" align="left">For example -<br>expression in target</TD>
156: * <TH id="mirrored3" align="left">Is mirrored as</TD>
157: * <TH id="type3" align="left">{@link Type} of value</TD>
158: * <TR>
159: * <TD headers="other kind3"> null</TD>
160: * <TD headers="other example3"> <CODE>null</CODE></TD>
161: * <TD headers="other mirrored3"> <CODE>null</CODE></TD>
162: * <TD headers="other type3"> n/a</TD>
163: * </TABLE>
164: *
165: * @author Robert Field
166: * @author Gordon Hirsch
167: * @author James McIlree
168: * @since 1.3
169: */
170:
171: public interface Value extends Mirror {
172: /**
173: * Returns the run-time type of this value.
174: *
175: * @see Type
176: * @return a {@link Type} which mirrors the value's type in the
177: * target VM.
178: */
179: Type type();
180: }
|