How to get all possible values of an enum in java? (not knowing the specific Enum) [duplicate]
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()
精彩评论