ExecutionContext

class ExecutionContext(val context: Context, val logger: Logger = Logger.logger, val state: MutableMap<String, Any> = mutableMapOf())

Execution context for migration steps providing access to Android context, logging, and shared state across steps.

The ExecutionContext serves as a container for utilities and state that migration steps may need during execution. It provides:

  • Android Context: For accessing system services and resources

  • Logger: For consistent logging across migration steps

  • Shared State: For passing data between migration steps

State Management:

The state map allows steps to store and retrieve data that may be needed by subsequent steps:

step("Load configuration") {
val config = loadConfiguration()
state["config"] = config
MigrationStepResult.CONTINUE
}

step("Apply configuration") {
val config = getValue<Configuration>("config")
if (config != null) {
applyConfiguration(config)
MigrationStepResult.CONTINUE
} else {
logger.e("Configuration not found in state")
throw IllegalStateException("Missing configuration")
}
}

Parameters

context

Android context for system access

logger

Logger instance for consistent logging

state

Mutable map for sharing data between migration steps

Constructors

Link copied to clipboard
constructor(context: Context, logger: Logger = Logger.logger, state: MutableMap<String, Any> = mutableMapOf())

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
inline fun <T> getValue(key: String): T?

Retrieves a typed value from the execution state.