I\'m trying to find a way to iterate through an enum\'s values while using generics. Not sure how to do this or if it is possible.
The following code illustrates
Here below an example of a wrapper class around an Enum. Is a little bit weird bu is what i need :
public class W2UIEnum & Resumable> {
public String id;
public String caption;
public W2UIEnum(ApplicationContext appContext, T t) {
this.id = t.getResume();
this.caption = I18N.singleInstance.getI18nString(t.name(), "enum_"
+ t.getClass().getSimpleName().substring(0, 1).toLowerCase()
+ t.getClass().getSimpleName().substring(1,
t.getClass().getSimpleName().length()), appContext
.getLocale());
}
public static & Resumable> List> values(
ApplicationContext appContext, Class enumType) {
List> statusList = new ArrayList>();
for (T status : enumType.getEnumConstants()) {
statusList.add(new W2UIEnum(appContext, status));
}
return statusList;
}
}