1 /* 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. 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. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * 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 @jdk.Exported 48 public interface TypeComponent extends Mirror, Accessible { 49 50 /** 51 * Gets the name of this type component. 52 * <P> 53 * Note: for fields, this is the field name; for methods, 54 * this is the method name; for constructors, this is <init>; 55 * for static initializers, this is <clinit>. 56 * 57 * @return a string containing the name. 58 */ name()59 String name(); 60 61 /** 62 * Gets the JNI-style signature for this type component. The 63 * signature is encoded type information as defined 64 * in the JNI documentation. It is a convenient, compact format for 65 * for manipulating type information internally, not necessarily 66 * for display to an end user. See {@link Field#typeName} and 67 * {@link Method#returnTypeName} for ways to help get a more readable 68 * representation of the type. 69 * 70 * @see <a href="doc-files/signature.html">Type Signatures</a> 71 * @return a string containing the signature 72 */ signature()73 String signature(); 74 75 /** 76 * Gets the generic signature for this TypeComponent if there is one. 77 * Generic signatures are described in the 78 * <cite>The Java™ Virtual Machine Specification</cite>. 79 * 80 * @return a string containing the generic signature, or <code>null</code> 81 * if there is no generic signature. 82 * 83 * @since 1.5 84 */ genericSignature()85 String genericSignature(); 86 87 /** 88 * Returns the type in which this component was declared. The 89 * returned {@link ReferenceType} mirrors either a class or an 90 * interface in the target VM. 91 * 92 * @return a {@link ReferenceType} for the type that declared 93 * this type component. 94 */ declaringType()95 ReferenceType declaringType(); 96 97 /** 98 * Determines if this TypeComponent is static. 99 * Return value is undefined for constructors and static initializers. 100 * 101 * @return <code>true</code> if this type component was declared 102 * static; false otherwise. 103 */ isStatic()104 boolean isStatic(); 105 106 /** 107 * Determines if this TypeComponent is final. 108 * Return value is undefined for constructors and static initializers. 109 * 110 * @return <code>true</code> if this type component was declared 111 * final; false otherwise. 112 */ isFinal()113 boolean isFinal(); 114 115 /** 116 * Determines if this TypeComponent is synthetic. Synthetic members 117 * are generated by the compiler and are not present in the source 118 * code for the containing class. 119 * <p> 120 * Not all target VMs support this query. See 121 * {@link VirtualMachine#canGetSyntheticAttribute} to determine if the 122 * operation is supported. 123 * 124 * @return <code>true</code> if this type component is synthetic; 125 * <code>false</code> otherwise. 126 * @throws java.lang.UnsupportedOperationException if the target 127 * VM cannot provide information on synthetic attributes. 128 */ isSynthetic()129 boolean isSynthetic(); 130 } 131