CollectorFactory

The CollectorFactory object is responsible for creating and managing Collector instances. It maintains a map of collector creation functions, keyed by type. It also provides functions to register new types of collectors and to create collectors from a JsonArray.

Functions

Link copied to clipboard
fun collector(array: JsonArray): List<Collector>

Creates a list of Collector instances from a JsonArray. Each JsonObject in the array should have a "type" field that matches a registered Collector type.

Link copied to clipboard
fun inject(davinci: DaVinci, continueNode: ContinueNode)

Injects the DaVinci and ContinueNode instances into the collectors.

Link copied to clipboard
fun register(type: String, block: () -> Collector)

Registers a new type of Collector.

Link copied to clipboard
fun reset()

Resets the CollectorFactory by clearing all registered collectors.