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

colesico.framework.slf4j.Slf4jIoclet Maven / Gradle / Ivy

There is a newer version: 5.3.0
Show newest version
// This is automatically generated file. Do not modify!
package colesico.framework.slf4j;

import colesico.framework.assist.LazySingleton;
import colesico.framework.assist.codegen.Genstamp;
import colesico.framework.ioc.ioclet.AdvancedIoc;
import colesico.framework.ioc.ioclet.Catalog;
import colesico.framework.ioc.ioclet.Factory;
import colesico.framework.ioc.ioclet.Ioclet;
import colesico.framework.ioc.key.TypeKey;
import colesico.framework.ioc.message.InjectionPoint;
import colesico.framework.ioc.production.InstanceProducingException;
import org.slf4j.Logger;

@Genstamp(
        generator = "colesico.framework.ioc.codegen.generator.IocletGenerator",
        timestamp = "2021-05-31T10:06:58.740Z",
        hashId = "6b21ec3f-e74e-494c-a26f-5d347b93ade7",
        comments = "Producer: colesico.framework.slf4j.Slf4jProducer"
)
public final class Slf4jIoclet implements Ioclet {
    private final LazySingleton producer = new LazySingleton() {
        @Override
        public final Slf4jProducer create() {
            return new Slf4jProducer();
        }
    };

    @Override
    public final String getId() {
        return "colesico.framework.slf4j.Slf4jProducer";
    }

    /**
     * Factory to produce org.slf4j.Logger class instance
     * Scope: UNSCOPED; Custom: null
     */
    public Factory getLoggerFactory0() {
        return new Factory() {
            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: org.slf4j.Logger
            }

            @Override
            public final Logger get(final Object message) {
                try {
                    // Perform instance producing
                    Logger instance = producer.get().getLogger((InjectionPoint)message);
                    return instance;
                } catch (InstanceProducingException ipe) {
                    throw ipe;
                } catch (Throwable t) {
                    throw new InstanceProducingException(t, Logger.class);
                }
            }
        };
    }

    @Override
    public final void addFactories(final Catalog catalog) {
        if(catalog.accept(new TypeKey("org.slf4j.Logger"), null, null, false)){
            catalog.add(getLoggerFactory0());
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy