Interface Field
- All Superinterfaces:
Accessible, Comparable<Field>, Mirror, TypeComponent
A class or instance variable in the target VM.
See
TypeComponent
for general information about Field and Method mirrors.- Since:
- 1.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares the specified Object with this field for equality.inthashCode()Returns the hash code value for this Field.booleanDetermine if this is a field that represents an enum constant.booleanDetermine if this is a transient field.booleanDetermine if this is a volatile field.type()Returns the type of this field.typeName()Returns a text representation of the type of this field.Methods declared in interface Accessible
isPackagePrivate, isPrivate, isProtected, isPublic, modifiersModifier and TypeMethodDescriptionbooleanDetermines if this object mirrors a package private item.booleanDetermines if this object mirrors a private item.booleanDetermines if this object mirrors a protected item.booleanisPublic()Determines if this object mirrors a public item.intReturns the Java programming language modifiers, encoded in an integer.Methods declared in interface Comparable
compareToMethods declared in interface Mirror
toString, virtualMachineModifier and TypeMethodDescriptiontoString()Returns a String describing this mirrorGets the VirtualMachine to which this Mirror belongs.Methods declared in interface TypeComponent
declaringType, genericSignature, isFinal, isStatic, isSynthetic, name, signatureModifier and TypeMethodDescriptionReturns the type in which this component was declared.Gets the generic signature for this TypeComponent if there is one.booleanisFinal()Determines if this TypeComponent is final.booleanisStatic()Determines if this TypeComponent is static.booleanDetermines if this TypeComponent is synthetic.name()Gets the name of this type component.Gets the type signature for this type component.
-
Method Details
-
typeName
String typeName()Returns a text representation of the type of this field. Where the type is the type specified in the declaration of this field.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
Returns the type of this field. Where the type is the type specified in the declaration of this field.For example, if a target class defines:
short s; Date d; byte[] ba;
And the JDI client defines theseFieldobjects:Field sField = targetClass.fieldByName("s"); Field dField = targetClass.fieldByName("d"); Field baField = targetClass.fieldByName("ba");to mirror the corresponding fields, thensField.type()is aShortType,dField.type()is theReferenceTypeforjava.util.Dateand((ArrayType)(baField.type())).componentType()is aByteType.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 aClassNotPreparedException. UseReferenceType.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()Determine if this is a transient field.- Returns:
trueif this field is transient;falseotherwise.
-
isVolatile
boolean isVolatile()Determine if this is a volatile field.- Returns:
trueif this field is volatile;falseotherwise.
-
isEnumConstant
boolean isEnumConstant()Determine if this is a field that represents an enum constant.- Returns:
trueif this field represents an enum constant;falseotherwise.
-
equals
Compares the specified Object with this field for equality. -
hashCode
-