com.github.lontime.extcopper.impl.DefaultRdbmsEngineFactory Maven / Gradle / Ivy
package com.github.lontime.extcopper.impl;
import java.util.Optional;
import com.github.lontime.extcopper.configuration.PersitenceOption;
import org.copperengine.core.DependencyInjector;
import org.copperengine.core.util.PojoDependencyInjector;
/**
* PojoRdbmsEngineFactory.
* @author lontime
* @since 1.0
*/
public class DefaultRdbmsEngineFactory extends AbstractRdbmsEngineFactory {
private DependencyInjector dependencyInjector;
public DefaultRdbmsEngineFactory(PersitenceOption option, DependencyInjector dependencyInjector) {
super(option);
this.dependencyInjector = dependencyInjector;
}
public DefaultRdbmsEngineFactory(PersitenceOption option) {
this(option, new PojoDependencyInjector());
}
@Override
protected DependencyInjector createDependencyInjector() {
return Optional.ofNullable(dependencyInjector).orElse(new PojoDependencyInjector());
}
}