开发者

How to get all possible values of an enum in java? (not knowing the specific Enum) [duplicate]

This question already has answers here: How to get all enum values in Java? (8 answers) Closed 5 years ago.

I'd like to create a JComboBox that handles the selection of any Enum given to it. For that I need a method to retrieve all the available values of the Enum passed to the JComboBox. As I don't know the specific Enum I can't call EnumType.valu开发者_C百科es(). I could think of some complicated solutions where supported Enums would have to implement some interface I define, but I guess I am missing a simpler, more general solution. What is the way I should go?


Class.getEnumConstants()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜