Example usage for org.springframework.scheduling.quartz JobDetailFactoryBean getClass

List of usage examples for org.springframework.scheduling.quartz JobDetailFactoryBean getClass

Introduction

In this page you can find the example usage for org.springframework.scheduling.quartz JobDetailFactoryBean getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.wiiyaya.provider.main.utils.BatchHelper.java

private static JobDetail getJobDetail(Batch task) {
    JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();

    jobDetailFactoryBean.setBeanName(task.getTaskName());
    try {//from  www.j  a va2 s .  c om
        jobDetailFactoryBean
                .setJobClass(jobDetailFactoryBean.getClass().getClassLoader().loadClass(task.getTaskClass()));
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
    jobDetailFactoryBean.setDurability(true);

    // Map<String, Integer> map = new HashMap<>();
    // map.put("timeout", new Integer(5));
    // jobDetailFactoryBean.setJobDataAsMap(map);

    jobDetailFactoryBean.afterPropertiesSet();

    return jobDetailFactoryBean.getObject();
}