![JAR search and dependency download from the Maven repository](/logo.png)
io.github.factoryfx.copperbridge.CopperEngineContextFactory Maven / Gradle / Ivy
package io.github.factoryfx.copperbridge;
import java.util.Map;
import io.github.factoryfx.factory.attribute.dependency.FactoryAttribute;
import io.github.factoryfx.factory.attribute.types.StringAttribute;
import io.github.factoryfx.factory.FactoryBase;
import org.copperengine.core.tranzient.TransientScottyEngine;
public abstract class CopperEngineContextFactory> extends FactoryBase {
public final StringAttribute dependencyInjectorType = new StringAttribute().labelText("DependencyInjectorType");
public final FactoryAttribute> transientScottyEngine = new FactoryAttribute>().labelText("Transient engine").nullable();
public final FactoryAttribute> persistentScottyEngine = new FactoryAttribute>().labelText("Persistent engine").nullable();
public CopperEngineContextFactory(){
configLifeCycle().setCreator(()->{
// Here we need to break the ffx dependency injection, because we don't need a new engine in case of a dependency change
CopperEngineContext dependencyInjector = new CopperEngineContext(dependencyInjectorType.get(), createDependencyHashMap());
if(transientScottyEngine.instance()!=null) transientScottyEngine.instance().setDependencyInjector(dependencyInjector);
if(persistentScottyEngine.instance()!=null) persistentScottyEngine.instance().persistentProcessingEngine.setDependencyInjector(dependencyInjector);
return dependencyInjector;
});
}
public abstract Map createDependencyHashMap();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy