create method
Create a TriggerExecutor based on trigger
.
Returns null if trigger
is not supported by this factory.
Implementation
@override
TriggerExecutor<TriggerConfiguration> create(TriggerConfiguration trigger) {
if (trigger is ElapsedTimeTrigger) return ElapsedTimeTriggerExecutor();
if (trigger is ScheduledTrigger) {
warning("ScheduledTrigger is not implemented yet. "
"Using an 'ImmediateTriggerExecutor' instead.");
return ImmediateTriggerExecutor();
}
if (trigger is NoOpTrigger) return NoOpTriggerExecutor();
if (trigger is ImmediateTrigger) return ImmediateTriggerExecutor();
if (trigger is OneTimeTrigger) return OneTimeTriggerExecutor();
if (trigger is DelayedTrigger) return DelayedTriggerExecutor();
if (trigger is PeriodicTrigger) return PeriodicTriggerExecutor();
if (trigger is DateTimeTrigger) return DateTimeTriggerExecutor();
if (trigger is RecurrentScheduledTrigger) {
return RecurrentScheduledTriggerExecutor();
}
if (trigger is CronScheduledTrigger) return CronScheduledTriggerExecutor();
if (trigger is SamplingEventTrigger) return SamplingEventTriggerExecutor();
if (trigger is ConditionalSamplingEventTrigger) {
return ConditionalSamplingEventTriggerExecutor();
}
if (trigger is ConditionalPeriodicTrigger) {
return ConditionalPeriodicTriggerExecutor();
}
if (trigger is RandomRecurrentTrigger) {
return RandomRecurrentTriggerExecutor();
}
if (trigger is PassiveTrigger) return PassiveTriggerExecutor();
if (trigger is UserTaskTrigger) return UserTaskTriggerExecutor();
warning(
"Unknown trigger used - cannot find a TriggerExecutor for the trigger of type '${trigger.runtimeType}'. "
"Using an 'ImmediateTriggerExecutor' instead.");
return ImmediateTriggerExecutor();
}