Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jdi/Field.java
38831 views
/*1* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jdi;2627/**28* A class or instance variable in the target VM.29* See {@link TypeComponent}30* for general information about Field and Method mirrors.31*32* @see ObjectReference33* @see ReferenceType34*35* @author Robert Field36* @author Gordon Hirsch37* @author James McIlree38* @since 1.339*/40@jdk.Exported41public interface Field extends TypeComponent, Comparable<Field> {4243/**44* Returns a text representation of the type45* of this field.46* Where the type is the type specified in the declaration47* of this field.48* <P>49* This type name is always available even if50* the type has not yet been created or loaded.51*52* @return a String representing the53* type of this field.54*/55String typeName();5657/**58* Returns the type of this field.59* Where the type is the type specified in the declaration60* of this field.61* <P>62* For example, if a target class defines:63* <PRE>64* short s;65* Date d;66* byte[] ba;</PRE>67* And the JDI client defines these <CODE>Field</CODE> objects:68* <PRE>69* Field sField = targetClass.fieldByName("s");70* Field dField = targetClass.fieldByName("d");71* Field baField = targetClass.fieldByName("ba");</PRE>72* to mirror the corresponding fields, then <CODE>sField.type()</CODE>73* is a {@link ShortType}, <CODE>dField.type()</CODE> is the74* {@link ReferenceType} for <CODE>java.util.Date</CODE> and75* <CODE>((ArrayType)(baField.type())).componentType()</CODE> is a76* {@link ByteType}.77* <P>78* Note: if the type of this field is a reference type (class,79* interface, or array) and it has not been created or loaded80* by the declaring type's class loader - that is,81* {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}82* <CODE>.classLoader()</CODE>,83* then ClassNotLoadedException will be thrown.84* Also, a reference type may have been loaded but not yet prepared,85* in which case the type will be returned86* but attempts to perform some operations on the returned type87* (e.g. {@link ReferenceType#fields() fields()}) will throw88* a {@link ClassNotPreparedException}.89* Use {@link ReferenceType#isPrepared()} to determine if90* a reference type is prepared.91*92* @see Type93* @return the {@link Type} of this field.94* @throws ClassNotLoadedException if the type has not yet been loaded95* or created through the appropriate class loader.96*/97Type type() throws ClassNotLoadedException;9899/**100* Determine if this is a transient field.101*102* @return <code>true</code> if this field is transient; false otherwise.103*/104boolean isTransient();105106/**107* Determine if this is a volatile field.108*109* @return <code>true</code> if this field is volatile; false otherwise.110*/111boolean isVolatile();112113/**114* Determine if this is a field that represents an enum constant.115* @return <code>true</code> if this field represents an enum constant;116* false otherwise.117*/118boolean isEnumConstant();119120/**121* Compares the specified Object with this field for equality.122*123* @return true if the Object is a Field and if both124* mirror the same field (declared in the same class or interface, in125* the same VM).126*/127boolean equals(Object obj);128129/**130* Returns the hash code value for this Field.131*132* @return the integer hash code133*/134int hashCode();135}136137138