RollbackToolRegistry

A registry for managing and retrieving rollback tools associated with specific tools. This class allows for the association of tools that have rollback counterparts and provides mechanisms for retrieval and addition of such tools.

This class is immutable from an external perspective, ensuring thread safety.

Types

Link copied to clipboard
class Builder

A builder class responsible for creating a RollbackToolRegistry while managing associations between tools and their corresponding rollback tools.

Link copied to clipboard
object Companion

Companion object for the RollbackToolRegistry class. Provides utility methods and predefined registry instances.

Properties

Link copied to clipboard
val rollbackToolsMap: Map<Tool<*, *>, Tool<*, *>>

A public property representing a map of tools and their corresponding rollback tools.

Functions

Link copied to clipboard
fun <TArgs> add(tool: Tool<TArgs, *>, rollbackTool: Tool<TArgs, *>)

Adds a tool and its corresponding rollback tool to the registry. If the tool is already present in the registry, the method does nothing.

Link copied to clipboard
fun RollbackToolRegistry.add(toolFunction: KFunction<*>, rollbackToolFunction: KFunction<*>)

Adds a tool and its corresponding rollback tool to the registry. This convenience method converts both toolFunction and rollbackToolFunction into Tool objects before adding them.

Link copied to clipboard
fun getRollbackTool(toolName: String): Tool<*, *>?

Retrieves a rollback tool by its name.

Link copied to clipboard
operator fun plus(rollbackToolRegistry: RollbackToolRegistry): RollbackToolRegistry

Combines the rollback tools from the current RollbackToolRegistry instance and the specified rollbackToolRegistry into a new RollbackToolRegistry.