Skip to content

Commit

Permalink
opt: 自动注册步骤器
Browse files Browse the repository at this point in the history
  • Loading branch information
Ven committed Aug 17, 2023
1 parent 94b7df6 commit 3ed45b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assists/src/main/java/com/ven/assist/step/StepManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ object StepManager {
fun <T : StepImpl> execute(stepImpl: Class<T>, step: Int, delay: Long = Assists.Config.defaultStepDelay, data: Any? = null) {
if (isStop) return
LogUtils.d("execute->${stepImpl.name}:$step", "delay:$delay")
stepCollector[stepImpl.name] ?: register(stepImpl)
stepCollector[stepImpl.name]?.get(step)?.let {
it.data = data
it.execute(delay)
} ?: throw RuntimeException("The class ${stepImpl.name} is not registered. Please call StepManager.register() to register it first./类${stepImpl.name}未注册,请先调用StepManager.register()进行注册")
}
}

/**
Expand Down

0 comments on commit 3ed45b1

Please sign in to comment.