BackendFactory {parabar} | R Documentation |
BackendFactory
Description
This class is a factory that provides concrete implementations of the
Backend
abstract class.
Methods
Public methods
Method get()
Obtain a concrete implementation of the abstract Backend
class of the specified type.
Usage
BackendFactory$get(type)
Arguments
type
A character string specifying the type of the
Backend
to instantiate. Possible values are"sync"
and"async"
. See the Details section for more information.
Details
When type = "sync"
a SyncBackend
instance is created
and returned. When type = "async"
an AsyncBackend
instance is provided instead.
Returns
A concrete implementation of the class Backend
. It
throws an error if the requested backend type
is not supported.
Method clone()
The objects of this class are cloneable with this method.
Usage
BackendFactory$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Service
, Backend
, SyncBackend
,
AsyncBackend
, and ContextFactory
.
Examples
# Create a backend factory.
backend_factory <- BackendFactory$new()
# Get a synchronous backend instance.
backend <- backend_factory$get("sync")
# Check the class of the backend instance.
class(backend)
# Get an asynchronous backend instance.
backend <- backend_factory$get("async")
# Check the class of the backend instance.
class(backend)
[Package parabar version 1.1.1 Index]