Class PicoFactory

java.lang.Object
io.cucumber.picocontainer.PicoFactory
All Implemented Interfaces:
Container, Lookup, ObjectFactory

@API(status=STABLE) public final class PicoFactory extends Object implements ObjectFactory
  • Field Details

    • classes

      private final Set<Class<?>> classes
    • providers

      private final Set<Class<org.picocontainer.injectors.Provider>> providers
    • pico

      private @Nullable org.picocontainer.MutablePicoContainer pico
  • Constructor Details

    • PicoFactory

      public PicoFactory()
  • Method Details

    • isInstantiable

      private static boolean isInstantiable(Class<?> clazz)
    • 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 interface ObjectFactory
    • isProvider

      private static boolean isProvider(Class<?> clazz)
    • isProviderAdapter

      private static boolean isProviderAdapter(Class<?> clazz)
    • adapterForProviderClass

      private static org.picocontainer.injectors.ProviderAdapter adapterForProviderClass(Class<org.picocontainer.injectors.Provider> clazz)
    • 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 interface ObjectFactory
    • 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().

      Specified by:
      addClass in interface Container
      Parameters:
      clazz - glue class to add to the text context.
      Returns:
      should always return true, should be ignored.
    • addDependency

      private void addDependency(Class<?> clazz)
    • hasDefaultConstructor

      private static boolean hasDefaultConstructor(Class<?> clazz)
    • requireConstructableProvider

      private static Class<org.picocontainer.injectors.Provider> requireConstructableProvider(Class<?> clazz)
    • getInstance

      public <T> T getInstance(Class<T> type)
      Description copied from interface: Lookup
      Provides an instance of a glue class.
      Specified by:
      getInstance in interface Lookup
      Type Parameters:
      T - type of Glue class
      Parameters:
      type - type of instance to be created.
      Returns:
      new instance of type T
    • addConstructorDependencies

      private void addConstructorDependencies(Class<?> clazz)