Skip to contents

This class is a factory that provides instances of the Context class.

Methods


Method get()

Obtain instances of the Context class.

Usage

ContextFactory$get(type)

Arguments

type

A character string specifying the type of the Context to instantiate. Possible values are "regular" and "progress". See the Details section for more information.

Details

When type = "regular" a Context instance is created and returned. When type = "progress" a ProgressTrackingContext instance is provided instead.

Returns

An object of type Context. It throws an error if the requested context type is not supported.


Method clone()

The objects of this class are cloneable with this method.

Usage

ContextFactory$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Create a context factory.
context_factory <- ContextFactory$new()

# Get a regular context instance.
context <- context_factory$get("regular")

# Check the class of the context instance.
class(context)
#> [1] "Context"        "BackendService" "R6"            

# Get a progress context instance.
context <- context_factory$get("progress")
class(context)
#> [1] "ProgressTrackingContext" "Context"                
#> [3] "BackendService"          "R6"