In my JSF application there are several drop down menus, with an enum for my selectItems in the background.
Currently I am using an ApplcationScoped ManagedBean to pass them to my view:
@ManagedBean(name="applicationUtil")
@ApplicationScoped
public class ApplicationUtil implements Serializable {
public MyEnum [] getValues() {
return MyEnum.values();
}
}
For better reusability I'd like to have something similar to e.g. the FacesValidator-Annotation to make it available in my JSF view. Somehting like
@Enum("com.stackoverflow.MyEnum")
public enum MyEnum {
//
}
Is there something similar available for enums? I think this is a quite common task, but I didn't find a solution for this. Or maybe are there reasons why this would be a bad idea?