Class ObjectBag


  • public final class ObjectBag
    extends java.lang.Object
    A simple bean bag that is intended to help share objects during the lifetime of TestNG without needing it to be a singleton.
    • Constructor Detail

      • ObjectBag

        public ObjectBag()
    • Method Detail

      • cleanup

        public static void cleanup​(ISuite suite)
      • createIfRequired

        public java.lang.Object createIfRequired​(java.lang.Class<?> type,
                                                 java.util.function.Supplier<java.lang.Object> supplier)
        Parameters:
        type - - The type of the object to be created
        supplier - - A Supplier that should be used to produce a new instance
        Returns:
        - Either the newly produced instance or the existing instance.
      • cleanup

        public void cleanup()