Path: blob/master/src/jdk.jdi/share/classes/com/sun/jdi/Field.java
41159 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*/40public interface Field extends TypeComponent, Comparable<Field> {4142/**43* Returns a text representation of the type44* of this field.45* Where the type is the type specified in the declaration46* of this field.47* <P>48* This type name is always available even if49* the type has not yet been created or loaded.50*51* @return a String representing the52* type of this field.53*/54String typeName();5556/**57* Returns the type of this field.58* Where the type is the type specified in the declaration59* of this field.60* <P>61* For example, if a target class defines:62* <PRE>63* short s;64* Date d;65* byte[] ba;</PRE>66* And the JDI client defines these {@code Field} objects:67* <PRE>68* Field sField = targetClass.fieldByName("s");69* Field dField = targetClass.fieldByName("d");70* Field baField = targetClass.fieldByName("ba");</PRE>71* to mirror the corresponding fields, then {@code sField.type()}72* is a {@link ShortType}, {@code dField.type()} is the73* {@link ReferenceType} for {@code java.util.Date} and74* {@code ((ArrayType)(baField.type())).componentType()} is a75* {@link ByteType}.76* <P>77* Note: if the type of this field is a reference type (class,78* interface, or array) and it has not been created or loaded79* by the declaring type's class loader - that is,80* {@link TypeComponent#declaringType declaringType()}81* {@code .classLoader()},82* then ClassNotLoadedException will be thrown.83* Also, a reference type may have been loaded but not yet prepared,84* in which case the type will be returned85* but attempts to perform some operations on the returned type86* (e.g. {@link ReferenceType#fields() fields()}) will throw87* a {@link ClassNotPreparedException}.88* Use {@link ReferenceType#isPrepared()} to determine if89* a reference type is prepared.90*91* @see Type92* @return the {@link Type} of this field.93* @throws ClassNotLoadedException if the type has not yet been loaded94* or created through the appropriate class loader.95*/96Type type() throws ClassNotLoadedException;9798/**99* Determine if this is a transient field.100*101* @return {@code true} if this field is transient; {@code false} otherwise.102*/103boolean isTransient();104105/**106* Determine if this is a volatile field.107*108* @return {@code true} if this field is volatile; {@code false} otherwise.109*/110boolean isVolatile();111112/**113* Determine if this is a field that represents an enum constant.114* @return {@code true} if this field represents an enum constant;115* {@code false} otherwise.116*/117boolean isEnumConstant();118119/**120* Compares the specified Object with this field for equality.121*122* @return {@code true} if the Object is a Field and if both123* mirror the same field (declared in the same class or interface, in124* the same VM).125*/126boolean equals(Object obj);127128/**129* Returns the hash code value for this Field.130*131* @return the integer hash code.132*/133int hashCode();134}135136137