package io.github.factoryfx.docu.update;

import io.github.factoryfx.factory.attribute.types.StringAttribute;
import io.github.factoryfx.factory.FactoryBase;


public class RootFactory extends FactoryBase<Root, RootFactory> {
    public final StringAttribute stringAttribute = new StringAttribute();

    public RootFactory(){
        configLifeCycle().setCreator(() ->  new Root(stringAttribute.get()));
        configLifeCycle().setStarter(root -> {
            //artificial long start time
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        });
        configLifeCycle().setUpdater(root -> root.setDummy(stringAttribute.get()));
    }
}

@@ -74,38 +74,18 @@
 ory.
-attribute.types.StringAttribut
+FactoryBas
 e;%0Ai
@@ -122,23 +122,42 @@
 ory.
-FactoryBas
+attribute.types.StringAttribut
 e;%0A%0A
-%0A
 publ
@@ -317,16 +317,17 @@
 actory()
+ 
 %7B%0A      
@@ -362,17 +362,16 @@
 or(() -%3E
- 
  new Roo
@@ -664,16 +664,16 @@
     %7D);%0A
-
         
@@ -743,21 +743,408 @@
 ute.get()));
+%0A%0A        // You can also conditionally recreate the expensive resource%0A        //configLifeCycle().setReCreator(root -%3E %7B%0A        //    if (stringAttribute.get().equals(%22someCondition%22)) %7B%0A        //        return new Root(stringAttribute.get());%0A        //    %7D else %7B%0A        //        root.setDummy(stringAttribute.get());%0A        //        return root;%0A        //    %7D%0A        //%7D);
 %0A    %7D%0A%7D%0A

extend example