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 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 <a href="{@docRoot}/../specs/jni/types.html#type-signatures"> 62 * type signature</a> 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 * @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 * <cite>The Java Virtual Machine Specification</cite>. 78 * 79 * @return a string containing the generic signature, or <code>null</code> 80 * if there is no generic signature. 81 * 82 * @since 1.5 83 */ 84 String genericSignature(); 85 86 /** 87 * Returns the type in which this component was declared. The 88 * returned {@link ReferenceType} mirrors either a class or an 89 * interface in the target VM. 90 * 91 * @return a {@link ReferenceType} for the type that declared 92 * this type component. 93 */ 94 ReferenceType declaringType(); 95 96 /** 97 * Determines if this TypeComponent is static. 98 * Return value is undefined for constructors and static initializers. 99 * 100 * @return <code>true</code> if this type component was declared 101 * static; false otherwise. 102 */ 103 boolean isStatic(); 104 105 /** 106 * Determines if this TypeComponent is final. 107 * Return value is undefined for constructors and static initializers. 108 * 109 * @return <code>true</code> if this type component was declared 110 * final; false otherwise. 111 */ 112 boolean isFinal(); 113 114 /** 115 * Determines if this TypeComponent is synthetic. Synthetic members 116 * are generated by the compiler and are not present in the source 117 * code for the containing class. 118 * <p> 119 * Not all target VMs support this query. See 120 * {@link VirtualMachine#canGetSyntheticAttribute} to determine if the 121 * operation is supported. 122 * 123 * @return <code>true</code> if this type component is synthetic; 124 * <code>false</code> otherwise. 125 * @throws java.lang.UnsupportedOperationException if the target 126 * VM cannot provide information on synthetic attributes. 127 */ 128 boolean isSynthetic(); 129 }