Interface Field
- All Superinterfaces:
Accessible, Comparable<Field>, Mirror, TypeComponent
public interface Field extends TypeComponent, Comparable<Field>
TypeComponent for general information about Field and Method mirrors.- Since:
- 1.3
- See Also:
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals |
Compares the specified Object with this field for equality. |
int |
hashCode() |
Returns the hash code value for this Field. |
boolean |
isEnumConstant() |
Determine if this is a field that represents an enum constant. |
boolean |
isTransient() |
Determine if this is a transient field. |
boolean |
isVolatile() |
Determine if this is a volatile field. |
Type |
type() |
Returns the type of this field. |
String |
typeName() |
Returns a text representation of the type of this field. |
Methods declared in interface Accessible
isPackagePrivate, isPrivate, isProtected, isPublic, modifiers | Modifier and Type | Method | Description |
|---|---|---|
boolean |
isPackagePrivate() |
Determines if this object mirrors a package private item. |
boolean |
isPrivate() |
Determines if this object mirrors a private item. |
boolean |
isProtected() |
Determines if this object mirrors a protected item. |
boolean |
isPublic() |
Determines if this object mirrors a public item. |
int |
modifiers() |
Returns the Java programming language modifiers, encoded in an integer. |
Methods declared in interface Comparable
compareTo | Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo |
Compares this object with the specified object for order. |
Methods declared in interface Mirror
toString, virtualMachine | Modifier and Type | Method | Description |
|---|---|---|
String |
toString() |
Returns a String describing this mirror |
VirtualMachine |
virtualMachine() |
Gets the VirtualMachine to which this Mirror belongs. |
Methods declared in interface TypeComponent
declaringType, genericSignature, isFinal, isStatic, isSynthetic, name, signature | Modifier and Type | Method | Description |
|---|---|---|
ReferenceType |
declaringType() |
Returns the type in which this component was declared. |
String |
genericSignature() |
Gets the generic signature for this TypeComponent if there is one. |
boolean |
isFinal() |
Determines if this TypeComponent is final. |
boolean |
isStatic() |
Determines if this TypeComponent is static. |
boolean |
isSynthetic() |
Determines if this TypeComponent is synthetic. |
String |
name() |
Gets the name of this type component. |
String |
signature() |
Gets the type signature for this type component. |
Method Details
typeName
String typeName()
This type name is always available even if the type has not yet been created or loaded.
- Returns:
- a String representing the type of this field.
type
Type type() throws ClassNotLoadedException
For example, if a target class defines:
short s; Date d; byte[] ba;And the JDI client defines these
Field objects:
Field sField = targetClass.fieldByName("s");
Field dField = targetClass.fieldByName("d");
Field baField = targetClass.fieldByName("ba"); to mirror the corresponding fields, then sField.type() is a ShortType, dField.type() is the ReferenceType for java.util.Date and ((ArrayType)(baField.type())).componentType() is a ByteType. Note: if the type of this field is a reference type (class, interface, or array) and it has not been created or loaded by the declaring type's class loader - that is, declaringType() .classLoader(), then ClassNotLoadedException will be thrown. Also, a reference type may have been loaded but not yet prepared, in which case the type will be returned but attempts to perform some operations on the returned type (e.g. fields()) will throw a ClassNotPreparedException. Use ReferenceType.isPrepared() to determine if a reference type is prepared.
- Returns:
- the
Typeof this field. - Throws:
-
ClassNotLoadedException- if the type has not yet been loaded or created through the appropriate class loader. - See Also:
isTransient
boolean isTransient()
- Returns:
-
trueif this field is transient;falseotherwise.
isVolatile
boolean isVolatile()
- Returns:
-
trueif this field is volatile;falseotherwise.
isEnumConstant
boolean isEnumConstant()
- Returns:
-
trueif this field represents an enum constant;falseotherwise.
equals
boolean equals(Object obj)
hashCode
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.