J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package com.sun.jdi; |
| 27 | |
| 28 | /** |
| 29 | * The mirror for a type in the target VM. |
| 30 | * This interface is the root of a type hierarchy encompassing primitive |
| 31 | * types and reference types. |
| 32 | * <P> |
| 33 | * A Type may be used to represent a run-time type: |
| 34 | * <BLOCKQUOTE> |
| 35 | * {@link Value}.type() |
| 36 | * </BLOCKQUOTE> |
| 37 | * or a compile-time type: |
| 38 | * <BLOCKQUOTE> |
| 39 | * {@link Field#type()} <BR> |
| 40 | * {@link Method#returnType()} <BR> |
| 41 | * {@link Method#argumentTypes()} <BR> |
| 42 | * {@link LocalVariable#type()} <BR> |
| 43 | * {@link ArrayType#componentType()} |
| 44 | * </BLOCKQUOTE> |
| 45 | * <P> |
| 46 | * The following table illustrates which subinterfaces of Type |
| 47 | * are used to mirror types in the target VM -- |
| 48 | * <TABLE BORDER=1 SUMMARY="Maps each type declared in target to a mirrored |
| 49 | * instance of a subinterface of PrimitiveType or ReferenceType"> |
| 50 | * <TR BGCOLOR="#EEEEFF"> |
| 51 | * <TH id="primtype" colspan=3>Subinterfaces of {@link PrimitiveType}</TH> |
| 52 | * <TR BGCOLOR="#EEEEFF"> |
| 53 | * <TH id="declared" align="left" colspan=2>Type declared in target as</TH> |
| 54 | * <TH id="mirrored" align="left">Is mirrored as an instance of</TH> |
| 55 | * <TR> |
| 56 | * <TD headers="primtype declared" colspan=2><CODE>boolean</CODE></TD> |
| 57 | * <TD headers="primtype mirrored"> {@link BooleanType}</TD> |
| 58 | * <TR> |
| 59 | * <TD headers="primtype declared" colspan=2><CODE>byte</CODE></TD> |
| 60 | * <TD headers="primtype mirrored">{@link ByteType}</TD> |
| 61 | * <TR> |
| 62 | * <TD headers="primtype declared" colspan=2><CODE>char</CODE></TD> |
| 63 | * <TD headers="primtype mirrored">{@link CharType}</TD> |
| 64 | * <TR> |
| 65 | * <TD headers="primtype declared" colspan=2><CODE>double</CODE></TD> |
| 66 | * <TD headers="primtype mirrored">{@link DoubleType}</TD> |
| 67 | * <TR> |
| 68 | * <TD headers="primtype declared" colspan=2><CODE>float</CODE></TD> |
| 69 | * <TD headers="primtype mirrored">{@link FloatType}</TD> |
| 70 | * <TR> |
| 71 | * <TD headers="primtype declared" colspan=2><CODE>int</CODE></TD> |
| 72 | * <TD headers="primtype mirrored">{@link IntegerType}</TD> |
| 73 | * <TR> |
| 74 | * <TD headers="primtype declared" colspan=2><CODE>long</CODE></TD> |
| 75 | * <TD headers="primtype mirrored">{@link LongType}</TD> |
| 76 | * <TR> |
| 77 | * <TD headers="primtype declared" colspan=2><CODE>short</CODE></TD> |
| 78 | * <TD headers="primtype mirrored">{@link ShortType}</TD> |
| 79 | * <TR> |
| 80 | * <TD headers="primtype declared" colspan=2><CODE>void</CODE></TD> |
| 81 | * <TD headers="primtype mirrored">{@link VoidType}</TD> |
| 82 | * <TR BGCOLOR="#EEEEFF"> |
| 83 | * <TH id="reftype" colspan=3>Subinterfaces of {@link ReferenceType}</TH> |
| 84 | * <TR BGCOLOR="#EEEEFF"> |
| 85 | * <TH id="declared2" align="left">Type declared in target as</TH> |
| 86 | * <TH id="example2" align="left">For example</TH> |
| 87 | * <TH id="mirrored2" align="left">Is mirrored as an instance of</TH> |
| 88 | * <TR> |
| 89 | * <TD headers="reftype declared2"><I>a class</I></TD> |
| 90 | * <TD headers="reftype example2"><CODE>Date</CODE></TD> |
| 91 | * <TD headers="reftype mirrored2">{@link ClassType}</TD> |
| 92 | * <TR> |
| 93 | * <TD headers="reftype declared2"><I>an interface</I></TD> |
| 94 | * <TD headers="reftype example2"><CODE>Runnable</CODE></TD> |
| 95 | * <TD headers="reftype mirrored2">{@link InterfaceType}</TD> |
| 96 | * <TR> |
| 97 | * <TD headers="reftype declared2"><I>an array</I></TD> |
| 98 | * <TD headers="reftype example2"> </TD> |
| 99 | * <TD headers="reftype mirrored2">{@link ArrayType}</TD> |
| 100 | * <TR> |
| 101 | * <TD headers="reftype declared2"><I>an array</I></TD> |
| 102 | * <TD headers="reftype example2"><CODE>int[]</CODE></TD> |
| 103 | * <TD headers="reftype mirrored2">{@link ArrayType} whose |
| 104 | * {@link ArrayType#componentType() componentType()} is |
| 105 | * {@link IntegerType}</TD> |
| 106 | * <TR> |
| 107 | * <TD headers="reftype declared2"><I>an array</I></TD> |
| 108 | * <TD headers="reftype example2"><CODE>Date[]</CODE></TD> |
| 109 | * <TD headers="reftype mirrored2">{@link ArrayType} whose |
| 110 | * {@link ArrayType#componentType() componentType()} is |
| 111 | * {@link ClassType}</TD> |
| 112 | * <TR> |
| 113 | * <TD headers="reftype declared2"><I>an array</I></TD> |
| 114 | * <TD headers="reftype example2"><CODE>Runnable[]</CODE></TD> |
| 115 | * <TD headers="reftype mirrored2">{@link ArrayType} whose |
| 116 | * {@link ArrayType#componentType() componentType()} is |
| 117 | * {@link InterfaceType}</TD> |
| 118 | * </TABLE> |
| 119 | * |
| 120 | * @see PrimitiveType Subinterface PrimitiveType |
| 121 | * @see ReferenceType Subinterface ReferenceType |
| 122 | * @see Value Value - for relationship between Type and Value |
| 123 | * @see Field#type() Field.type() - for usage examples |
| 124 | * |
| 125 | * @author Robert Field |
| 126 | * @author Gordon Hirsch |
| 127 | * @author James McIlree |
| 128 | * @since 1.3 |
| 129 | */ |
| 130 | public interface Type extends Mirror |
| 131 | { |
| 132 | /** |
| 133 | * Returns the JNI-style signature for this type. |
| 134 | * <p> |
| 135 | * For primitive classes |
| 136 | * the returned signature is the signature of the corresponding primitive |
| 137 | * type; for example, "I" is returned as the signature of the class |
| 138 | * represented by {@link java.lang.Integer#TYPE}. |
| 139 | * |
| 140 | * @see <a href="doc-files/signature.html">Type Signatures</a> |
| 141 | * @return the string containing the type signature. |
| 142 | */ |
| 143 | String signature(); |
| 144 | |
| 145 | /** |
| 146 | * @return a text representation of this type. |
| 147 | */ |
| 148 | String name(); |
| 149 | } |