I have an enum, e.g.
public enum TimerCommandType { DATAPUBLISH, CLEARCACHE } and I want to be able to generate a class using Generics, so it looks like:
TimerCommandClass<DATAPUBLISH> which will use the enum value inside the class when relevant.
Is this possible?
The reason I would like to have it is that I currently have many calls to Quartz Jobs like:
public JobDetailFactoryBean publishingJobDetail() { return QuartzSchedulerHelper.createJobDetail(QuartzPublishingJob.class); } and I want them to be replaced to:
QuartzSchedulerHelper.createJobDetail(TimerCommandClass<DATAPUBLISH>.class); where createJobDetail is simply:
static JobDetailFactoryBean createJobDetail(Class jobClass) { JobDetailFactoryBean factoryBean = new JobDetailFactoryBean(); factoryBean.setJobClass(jobClass); return factoryBean; }
DATAPUBLISHis not a type; it's an instance ofTimerCommandType.class DataPublishandclass ClearCache?TimeCommandTypeor takes aTimeCommandTypeas argument ?