< prev index next >

src/jdk.jdi/share/classes/com/sun/jdi/Field.java

Print this page




  48      * of this field.
  49      * <P>
  50      * This type name is always available even if
  51      * the type has not yet been created or loaded.
  52      *
  53      * @return a String representing the
  54      * type of this field.
  55      */
  56     String typeName();
  57 
  58     /**
  59      * Returns the type of this field.
  60      * Where the type is the type specified in the declaration
  61      * of this field.
  62      * <P>
  63      * For example, if a target class defines:
  64      * <PRE>
  65      *    short s;
  66      *    Date d;
  67      *    byte[] ba;</PRE>
  68      * And the JDI client defines these <CODE>Field</CODE> objects:
  69      * <PRE>
  70      *    Field sField = targetClass.fieldByName("s");
  71      *    Field dField = targetClass.fieldByName("d");
  72      *    Field baField = targetClass.fieldByName("ba");</PRE>
  73      * to mirror the corresponding fields, then <CODE>sField.type()</CODE>
  74      * is a {@link ShortType}, <CODE>dField.type()</CODE> is the
  75      * {@link ReferenceType} for <CODE>java.util.Date</CODE> and
  76      * <CODE>((ArrayType)(baField.type())).componentType()</CODE> is a
  77      * {@link ByteType}.
  78      * <P>
  79      * Note: if the type of this field is a reference type (class,
  80      * interface, or array) and it has not been created or loaded
  81      * by the declaring type's class loader - that is,
  82      * {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}
  83      * <CODE>.classLoader()</CODE>,
  84      * then ClassNotLoadedException will be thrown.
  85      * Also, a reference type may have been loaded but not yet prepared,
  86      * in which case the type will be returned
  87      * but attempts to perform some operations on the returned type
  88      * (e.g. {@link ReferenceType#fields() fields()}) will throw
  89      * a {@link ClassNotPreparedException}.
  90      * Use {@link ReferenceType#isPrepared()} to determine if
  91      * a reference type is prepared.
  92      *
  93      * @see Type
  94      * @return the {@link Type} of this field.
  95      * @throws ClassNotLoadedException if the type has not yet been loaded
  96      * or created through the appropriate class loader.
  97      */
  98     Type type() throws ClassNotLoadedException;
  99 
 100     /**
 101      * Determine if this is a transient field.
 102      *
 103      * @return <code>true</code> if this field is transient; false otherwise.
 104      */
 105     boolean isTransient();
 106 
 107     /**
 108      * Determine if this is a volatile field.
 109      *
 110      * @return <code>true</code> if this field is volatile; false otherwise.
 111      */
 112     boolean isVolatile();
 113 
 114     /**
 115      * Determine if this is a field that represents an enum constant.
 116      * @return <code>true</code> if this field represents an enum constant;
 117      * false otherwise.
 118      */
 119     boolean isEnumConstant();
 120 
 121     /**
 122      * Compares the specified Object with this field for equality.
 123      *
 124      * @return true if the Object is a Field and if both
 125      * mirror the same field (declared in the same class or interface, in
 126      * the same VM).
 127      */
 128     boolean equals(Object obj);
 129 
 130     /**
 131      * Returns the hash code value for this Field.
 132      *
 133      * @return the integer hash code
 134      */
 135     int hashCode();
 136 }


  48      * of this field.
  49      * <P>
  50      * This type name is always available even if
  51      * the type has not yet been created or loaded.
  52      *
  53      * @return a String representing the
  54      * type of this field.
  55      */
  56     String typeName();
  57 
  58     /**
  59      * Returns the type of this field.
  60      * Where the type is the type specified in the declaration
  61      * of this field.
  62      * <P>
  63      * For example, if a target class defines:
  64      * <PRE>
  65      *    short s;
  66      *    Date d;
  67      *    byte[] ba;</PRE>
  68      * And the JDI client defines these {@code Field} objects:
  69      * <PRE>
  70      *    Field sField = targetClass.fieldByName("s");
  71      *    Field dField = targetClass.fieldByName("d");
  72      *    Field baField = targetClass.fieldByName("ba");</PRE>
  73      * to mirror the corresponding fields, then {@code sField.type()}
  74      * is a {@link ShortType}, {@code dField.type()} is the
  75      * {@link ReferenceType} for {@code java.util.Date} and
  76      * {@code ((ArrayType)(baField.type())).componentType()} is a
  77      * {@link ByteType}.
  78      * <P>
  79      * Note: if the type of this field is a reference type (class,
  80      * interface, or array) and it has not been created or loaded
  81      * by the declaring type's class loader - that is,
  82      * {@link TypeComponent#declaringType declaringType()}
  83      * {@code .classLoader()},
  84      * then ClassNotLoadedException will be thrown.
  85      * Also, a reference type may have been loaded but not yet prepared,
  86      * in which case the type will be returned
  87      * but attempts to perform some operations on the returned type
  88      * (e.g. {@link ReferenceType#fields() fields()}) will throw
  89      * a {@link ClassNotPreparedException}.
  90      * Use {@link ReferenceType#isPrepared()} to determine if
  91      * a reference type is prepared.
  92      *
  93      * @see Type
  94      * @return the {@link Type} of this field.
  95      * @throws ClassNotLoadedException if the type has not yet been loaded
  96      * or created through the appropriate class loader.
  97      */
  98     Type type() throws ClassNotLoadedException;
  99 
 100     /**
 101      * Determine if this is a transient field.
 102      *
 103      * @return {@code true} if this field is transient; {@code false} otherwise.
 104      */
 105     boolean isTransient();
 106 
 107     /**
 108      * Determine if this is a volatile field.
 109      *
 110      * @return {@code true} if this field is volatile; {@code false} otherwise.
 111      */
 112     boolean isVolatile();
 113 
 114     /**
 115      * Determine if this is a field that represents an enum constant.
 116      * @return {@code true} if this field represents an enum constant;
 117      * {@code false} otherwise.
 118      */
 119     boolean isEnumConstant();
 120 
 121     /**
 122      * Compares the specified Object with this field for equality.
 123      *
 124      * @return {@code true} if the Object is a Field and if both
 125      * mirror the same field (declared in the same class or interface, in
 126      * the same VM).
 127      */
 128     boolean equals(Object obj);
 129 
 130     /**
 131      * Returns the hash code value for this Field.
 132      *
 133      * @return the integer hash code.
 134      */
 135     int hashCode();
 136 }
< prev index next >