This is how I have written my enum.
public enum JobClass {
START_STOP(SchedularEvent<ExceptionNotificationsJob>.class),
EMAIL_NOTIFICATION(SchedularEvent<GenericNotificationsJob>.class);
private Class clazz;
JobClass(Class<?> clazz) {
this.clazz = clazz;
}
public Class getClazz() {
return this.clazz;
}
}
However this does not compile! It throws following errors.
Multiple markers at this line
- The constructor JobClass() is undefined
- Syntax error on token ">", byte expected after this token
- The constructor JobClass() is undefined
I am not sure how I should write this.
My aim is to get SchedularEvent<ExceptionNotificationsJob>.class when I call JobClass.START_STOP.getClazz(). How do I achieve this?
Thanks in advance!
Classrepresentation of a parametrized type, the best you can do is use a class literal of the raw type:SchedularEvent.class. The solution really depends on the use, do you just need the class to create instances?