Package io.cucumber.core.backend
Class DefaultObjectFactory
- java.lang.Object
-
- io.cucumber.core.backend.DefaultObjectFactory
-
- All Implemented Interfaces:
Container
,Lookup
,ObjectFactory
@API(status=STABLE, since="7.1.0") public final class DefaultObjectFactory extends Object implements ObjectFactory
Default factory to instantiate glue classes. Loaded via SPI.This object factory instantiates glue classes by using their public no-argument constructor. As such it does not provide any dependency injection.
Note: This class is intentionally an explicit part of the public api. It allows the default object factory to be used even when another object factory implementation is present through the "cucumber.object-factory" property or equivalent configuration options.
- See Also:
ObjectFactory
-
-
Constructor Summary
Constructors Constructor Description DefaultObjectFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addClass(Class<?> clazz)
Add a glue class to the test context.<T> T
getInstance(Class<T> type)
Provides an instance of a glue class.void
start()
Start the object factory.void
stop()
Stops the object factory.
-
-
-
Method Detail
-
start
public void start()
Description copied from interface:ObjectFactory
Start the object factory. Invoked once per scenario.While started
Lookup.getInstance(Class)
may be invoked.- Specified by:
start
in interfaceObjectFactory
-
stop
public void stop()
Description copied from interface:ObjectFactory
Stops the object factory. Called once per scenario.When stopped the object factory should dispose of all glue instances.
- Specified by:
stop
in interfaceObjectFactory
-
addClass
public boolean addClass(Class<?> clazz)
Description copied from interface:Container
Add a glue class to the test context.Invoked after creation but before
ObjectFactory.start()
.
-
getInstance
public <T> T getInstance(Class<T> type)
Description copied from interface:Lookup
Provides an instance of a glue class.- Specified by:
getInstance
in interfaceLookup
- Type Parameters:
T
- type of Glue class- Parameters:
type
- type of instance to be created.- Returns:
- new instance of type T
-
-