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

io.smallrye.beanbag.InjectingSupplier Maven / Gradle / Ivy

There is a newer version: 1.5.2
Show newest version
package io.smallrye.beanbag;

import java.util.List;

/**
 * A provider which injects things into injectors after getting the instance from another provider.
 */
final class InjectingSupplier implements BeanSupplier {
    private final BeanSupplier instanceSupplier;
    private final List> injectors;

    InjectingSupplier(final BeanSupplier instanceSupplier, final List> injectors) {
        this.instanceSupplier = instanceSupplier;
        this.injectors = injectors;
    }

    public T get(Scope scope) {
        final T instance = instanceSupplier.get(scope);
        for (Injector injector : injectors) {
            injector.injectInto(scope, instance);
        }
        return instance;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy