krontab/src/commonMain/kotlin/KrontabTemplateWrapper.kt

27 lines
926 B
Kotlin
Raw Normal View History

package dev.inmo.krontab
2021-01-02 15:55:06 +00:00
/**
* This class contains [template] and can be simply serialized/deserialized. In fact that class will work as
* [dev.inmo.krontab.internal.CronDateTimeScheduler] due to the fact that [toKronScheduler] will return it under the
* hood
*/
@Deprecated(
"It is useless wrapper for KrontabTemplate. Use KrontabConfig instead",
ReplaceWith("KrontabConfig(template)", "dev.inmo.krontab.KrontabConfig")
)
data class KrontabTemplateWrapper(
val template: KrontabTemplate
) : KronScheduler by template.toKronScheduler()
2021-01-02 15:55:06 +00:00
/**
* Will create [KrontabTemplateWrapper] from [this] [KrontabTemplate]
*
* @see [toKronScheduler]
* @see [KrontabTemplateWrapper]
*/
@Deprecated(
"Will be removed in near major update with KrontabTemplateWrapper",
ReplaceWith("this.krontabConfig", "dev.inmo.krontab.krontabConfig")
)
2021-01-02 15:55:06 +00:00
fun KrontabTemplate.wrapAsKronScheduler() = KrontabTemplateWrapper(this)