All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.osgl.inject.provider.LazyProvider Maven / Gradle / Ivy

There is a newer version: 1.13.2
Show newest version
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 clazz;
    private Injector injector;

    public LazyProvider(Class 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