public class PropertySettingJobFactory
extends org.quartz.simpl.SimpleJobFactory
class.newInstance()), and
then attempts to set all values from the SchedulerContext and
the JobExecutionContext's merged JobDataMap onto
bean properties of the Job.
Set the warnIfPropertyNotFound property to true if you'd like noisy logging in the case of values in the JobDataMap not mapping to properties on your Job class. This may be useful for troubleshooting typos of property names, etc. but very noisy if you regularly (and purposely) have extra things in your JobDataMap.
Also of possible interest is the throwIfPropertyNotFound property which will throw exceptions on unmatched JobDataMap keys.
JobFactory,
SimpleJobFactory,
SchedulerContext,
JobExecutionContext.getMergedJobDataMap(),
setWarnIfPropertyNotFound(boolean),
setThrowIfPropertyNotFound(boolean)| Constructor and Description |
|---|
PropertySettingJobFactory() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isThrowIfPropertyNotFound()
Whether the JobInstantiation should fail and throw and exception if
a key (name) and value (type) found in the JobDataMap does not
correspond to a proptery setter on the Job class.
|
boolean |
isWarnIfPropertyNotFound()
Whether a warning should be logged if
a key (name) and value (type) found in the JobDataMap does not
correspond to a proptery setter on the Job class.
|
org.quartz.Job |
newJob(org.quartz.spi.TriggerFiredBundle bundle,
org.quartz.Scheduler scheduler) |
protected void |
setBeanProps(java.lang.Object obj,
org.quartz.JobDataMap data) |
void |
setThrowIfPropertyNotFound(boolean throwIfNotFound)
Whether the JobInstantiation should fail and throw and exception if
a key (name) and value (type) found in the JobDataMap does not
correspond to a proptery setter on the Job class.
|
void |
setWarnIfPropertyNotFound(boolean warnIfNotFound)
Whether a warning should be logged if
a key (name) and value (type) found in the JobDataMap does not
correspond to a proptery setter on the Job class.
|
public org.quartz.Job newJob(org.quartz.spi.TriggerFiredBundle bundle,
org.quartz.Scheduler scheduler)
throws org.quartz.SchedulerException
newJob in interface org.quartz.spi.JobFactorynewJob in class org.quartz.simpl.SimpleJobFactoryorg.quartz.SchedulerExceptionprotected void setBeanProps(java.lang.Object obj,
org.quartz.JobDataMap data)
throws org.quartz.SchedulerException
org.quartz.SchedulerExceptionpublic boolean isThrowIfPropertyNotFound()
public void setThrowIfPropertyNotFound(boolean throwIfNotFound)
throwIfNotFound - defaults to false.public boolean isWarnIfPropertyNotFound()
public void setWarnIfPropertyNotFound(boolean warnIfNotFound)
warnIfNotFound - defaults to true.Copyright © 2022 The Apache Software Foundation. All rights reserved.