I currently have a utility method that will take in an enum, and convert that enum into a List of SelectItem objects to display on in a SelectOneMenu in JSF. Here is that method:
This uses the enum.name() as both the code and the label for the SelectOneMenu. What I would like to do, is to be able to set up an enum with a description as shown below, and use that description as the label:
In this example, I'd create an interface called Selectable that would force the user to implement the getDescription() method. I'd like to modify the method that creates the SelectItems to only take in an enum which implements the Selectable interface. I'm not sure how to do this. When I start thinking about generics, I just get lost. Any help would be appreciated.