org.osgl.inject.provider.LazyProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of genie Show documentation
Show all versions of genie Show documentation
A JSR330 style dependency injection solution
package org.osgl.inject.provider;
import org.osgl.$;
import org.osgl.inject.Injector;
import javax.inject.Provider;
/**
* A lazy provider is prepared with the bean class and initialize
* the bean upon demand
*/
public class LazyProvider implements Provider {
private Class extends T> clazz;
private Injector injector;
public LazyProvider(Class extends T> clazz, Injector injector) {
this.clazz = $.notNull(clazz);
this.injector = $.notNull(injector);
}
@Override
public T get() {
return injector.get(clazz);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy