J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1998-2003 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 | * An entity declared within a user defined |
| 30 | * type (class or interface). |
| 31 | * This interface is the root of the type |
| 32 | * component hierarchy which |
| 33 | * includes {@link Field} and {@link Method}. |
| 34 | * Type components of the same name declared in different classes |
| 35 | * (including those related by inheritance) have different |
| 36 | * TypeComponent objects. |
| 37 | * TypeComponents can be used alone to retrieve static information |
| 38 | * about their declaration, or can be used in conjunction with a |
| 39 | * {@link ReferenceType} or {@link ObjectReference} to access values |
| 40 | * or invoke, as applicable. |
| 41 | * |
| 42 | * @author Robert Field |
| 43 | * @author Gordon Hirsch |
| 44 | * @author James McIlree |
| 45 | * @since 1.3 |
| 46 | */ |
| 47 | public interface TypeComponent extends Mirror, Accessible { |
| 48 | |
| 49 | /** |
| 50 | * Gets the name of this type component. |
| 51 | * <P> |
| 52 | * Note: for fields, this is the field name; for methods, |
| 53 | * this is the method name; for constructors, this is <init>; |
| 54 | * for static initializers, this is <clinit>. |
| 55 | * |
| 56 | * @return a string containing the name. |
| 57 | */ |
| 58 | String name(); |
| 59 | |
| 60 | /** |
| 61 | * Gets the JNI-style signature for this type component. The |
| 62 | * signature is encoded type information as defined |
| 63 | * in the JNI documentation. It is a convenient, compact format for |
| 64 | * for manipulating type information internally, not necessarily |
| 65 | * for display to an end user. See {@link Field#typeName} and |
| 66 | * {@link Method#returnTypeName} for ways to help get a more readable |
| 67 | * representation of the type. |
| 68 | * |
| 69 | * @see <a href="doc-files/signature.html">Type Signatures</a> |
| 70 | * @return a string containing the signature |
| 71 | */ |
| 72 | String signature(); |
| 73 | |
| 74 | /** |
| 75 | * Gets the generic signature for this TypeComponent if there is one. |
| 76 | * Generic signatures are described in the |
| 77 | * <a href="http://java.sun.com/docs/books/vmspec"> |
| 78 | * "Java<sup><font size=-2>TM</font></sup> |
| 79 | * Virtual Machine Specification, 3rd Edition.</a> |
| 80 | * |
| 81 | * @return a string containing the generic signature, or <code>null</code> |
| 82 | * if there is no generic signature. |
| 83 | * |
| 84 | * @since 1.5 |
| 85 | */ |
| 86 | String genericSignature(); |
| 87 | |
| 88 | /** |
| 89 | * Returns the type in which this component was declared. The |
| 90 | * returned {@link ReferenceType} mirrors either a class or an |
| 91 | * interface in the target VM. |
| 92 | * |
| 93 | * @return a {@link ReferenceType} for the type that declared |
| 94 | * this type component. |
| 95 | */ |
| 96 | ReferenceType declaringType(); |
| 97 | |
| 98 | /** |
| 99 | * Determines if this TypeComponent is static. |
| 100 | * Return value is undefined for constructors and static initializers. |
| 101 | * |
| 102 | * @return <code>true</code> if this type component was declared |
| 103 | * static; false otherwise. |
| 104 | */ |
| 105 | boolean isStatic(); |
| 106 | |
| 107 | /** |
| 108 | * Determines if this TypeComponent is final. |
| 109 | * Return value is undefined for constructors and static initializers. |
| 110 | * |
| 111 | * @return <code>true</code> if this type component was declared |
| 112 | * final; false otherwise. |
| 113 | */ |
| 114 | boolean isFinal(); |
| 115 | |
| 116 | /** |
| 117 | * Determines if this TypeComponent is synthetic. Synthetic members |
| 118 | * are generated by the compiler and are not present in the source |
| 119 | * code for the containing class. |
| 120 | * <p> |
| 121 | * Not all target VMs support this query. See |
| 122 | * {@link VirtualMachine#canGetSyntheticAttribute} to determine if the |
| 123 | * operation is supported. |
| 124 | * |
| 125 | * @return <code>true</code> if this type component is synthetic; |
| 126 | * <code>false</code> otherwise. |
| 127 | * @throws java.lang.UnsupportedOperationException if the target |
| 128 | * VM cannot provide information on synthetic attributes. |
| 129 | */ |
| 130 | boolean isSynthetic(); |
| 131 | } |