- 所有父级接口:
Accessible,Comparable<Field>,Mirror,TypeComponent
目标 VM 中的类或实例变量。有关 Field 和 Method 镜像的一般信息,请参阅
TypeComponent 。
- 自从:
- 1.3
- 参见:
-
方法总结
在接口 com.sun.jdi.Accessible 中声明的方法
isPackagePrivate, isPrivate, isProtected, isPublic, modifiers在接口 java.lang.Comparable 中声明的方法
compareTo在接口 com.sun.jdi.Mirror 中声明的方法
toString, virtualMachine在接口 com.sun.jdi.TypeComponent 中声明的方法
declaringType, genericSignature, isFinal, isStatic, isSynthetic, name, signature
-
方法详情
-
typeName
String typeName()返回此字段类型的文本表示形式。其中 type 是该字段声明中指定的类型。即使尚未创建或加载该类型,此类型名称也始终可用。
- 返回:
- 表示此字段类型的字符串。
-
type
返回此字段的类型。其中 type 是该字段声明中指定的类型。例如,如果目标类定义:
short s; Date d; byte[] ba;
并且 JDI 客户端定义了这些Field对象:Field sField = targetClass.fieldByName("s"); Field dField = targetClass.fieldByName("d"); Field baField = targetClass.fieldByName("ba");以镜像相应的字段,然后sField.type()是一个ShortType,dField.type()是ReferenceTypeforjava.util.Date和((ArrayType)(baField.type())).componentType()是一个ByteType。注意:如果该字段的类型是引用类型(类、接口或数组),并且它尚未被声明类型的类加载器创建或加载 - 即
declaringType().classLoader(),则将抛出 ClassNotLoadedException。此外,引用类型可能已加载但尚未准备好,在这种情况下将返回该类型,但尝试对返回的类型执行某些操作(例如fields())将抛出ClassNotPreparedException。使用ReferenceType.isPrepared()确定是否准备了引用类型。- 返回:
-
该字段的
Type。 - 抛出:
ClassNotLoadedException- 如果类型尚未通过适当的类加载器加载或创建。- 参见:
-
isTransient
boolean isTransient()确定这是否是瞬态场。- 返回:
true如果这个字段是瞬态的;false否则。
-
isVolatile
boolean isVolatile()确定这是否是一个可变字段。- 返回:
true如果这个字段是可变的;false否则。
-
isEnumConstant
boolean isEnumConstant()确定这是否是表示枚举常量的字段。- 返回:
true如果此字段表示枚举常量;false否则。
-
equals
比较指定对象与此字段是否相等。 -
hashCode
int hashCode()返回此字段的哈希码值。
-