Package io.github.factoryfx.factory
Class FactoryBase.LifeCycleConfig<L,R extends FactoryBase<?,R>>
- java.lang.Object
-
- io.github.factoryfx.factory.FactoryBase.LifeCycleConfig<L,R>
-
- Enclosing class:
- FactoryBase<L,R extends FactoryBase<?,R>>
public static class FactoryBase.LifeCycleConfig<L,R extends FactoryBase<?,R>> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LifeCycleConfig(FactoryBase<L,R> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetCreator(java.util.function.Supplier<L> creator)create and prepare the liveObjectvoidsetDestroyer(java.util.function.Consumer<L> destroyerWithPreviousLiveObject)finally free liveObject e.g close a portvoidsetReCreator(java.util.function.Function<L,L> reCreatorWithPreviousLiveObject)the factory data has changed therefore a new liveobject is needed.
previousLiveObject can be used to pass runtime status from previous object (e.g request counter).
passed previous liveobject is never nullvoidsetStarter(java.util.function.Consumer<L> starterWithNewLiveObject)start the liveObject e.g open a portvoidsetUpdater(java.util.function.Consumer<L> updater)the factory data has changed therefore bud you want to reuse the liveObject and only update it.
(that means that parents do not have to be recreated.)
-
-
-
Constructor Detail
-
LifeCycleConfig
public LifeCycleConfig(FactoryBase<L,R> factory)
-
-
Method Detail
-
setCreator
public void setCreator(java.util.function.Supplier<L> creator)
create and prepare the liveObject- Parameters:
creator- creator
-
setReCreator
public void setReCreator(java.util.function.Function<L,L> reCreatorWithPreviousLiveObject)
the factory data has changed therefore a new liveobject is needed.
previousLiveObject can be used to pass runtime status from previous object (e.g request counter).
passed previous liveobject is never null- Parameters:
reCreatorWithPreviousLiveObject- reCreatorWithPreviousLiveObject
-
setUpdater
public void setUpdater(java.util.function.Consumer<L> updater)
the factory data has changed therefore bud you want to reuse the liveObject and only update it.
(that means that parents do not have to be recreated.)- Parameters:
updater- updater
-
setStarter
public void setStarter(java.util.function.Consumer<L> starterWithNewLiveObject)
start the liveObject e.g open a port- Parameters:
starterWithNewLiveObject- starterWithNewLiveObject
-
setDestroyer
public void setDestroyer(java.util.function.Consumer<L> destroyerWithPreviousLiveObject)
finally free liveObject e.g close a port- Parameters:
destroyerWithPreviousLiveObject- destroyerWithPreviousLiveObject
-
-