如何判断一个 `com.sun.jdi.ObjectReference` 是否为枚举?

huangapple go评论57阅读模式
英文:

How to know if an `com.sun.jdi.ObjectReference` is an Enum?

问题

如何判断一个 com.sun.jdi.ObjectReference 实例是否为枚举?我可以通过 ObjectReference.type() 获取实例的类型,该方法会返回一个 ClassType(如果它是一个类)。

英文:

How to find out if an com.sun.jdi.ObjectReference instance is an enum? I can get the type of the instance with ObjectReference.type() which gives a ClassType back (if it is a class).

答案1

得分: 1

使用com.sun.jdi.ClassType上的isEnum()方法。

英文:

Use the isEnum() method on com.sun.jdi.ClassType

huangapple
  • 本文由 发表于 2020年8月19日 04:36:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/63476251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定