我想將字符串數組傳遞給正在調度並由Scheduler對象調用的類。 調度類如下:如何在java中的石英調度中傳遞數組作爲參數
String stuff[]={"",""}
JobDetail job = JobBuilder.newJob(HelloJob.class)
.withIdentity("job", "group1").build();
job.getJobDataMap().put(HelloJob.data, stuff);
Trigger trigger = TriggerBuilder
.newTrigger()
.withSchedule(
CronScheduleBuilder.cronSchedule(time))
.build();
//schedule it
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
System.out.println("Before starting");
scheduler.start();
scheduler.scheduleJob(job, trigger);
數組傳遞到:
public class HelloJob implements Job {
static String data[];
public void execute(JobExecutionContext context) throws JobExecutionException {
System.out.println("Job");
}
}
作業接口:
public interface Job {
void execute(JobExecutionContext context)
throws JobExecutionException;
}
是否有任何解決方案來傳遞數組?