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

colesico.framework.httpserver.internal.HttpServerIoclet Maven / Gradle / Ivy

// This is automatically generated file. Do not modify!
package colesico.framework.httpserver.internal;

import colesico.framework.assist.LazySingleton;
import colesico.framework.assist.codegen.Genstamp;
import colesico.framework.httpserver.DefaultErrorHandler;
import colesico.framework.httpserver.ErrorHandler;
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.ioclet.SingletonFactory;
import colesico.framework.ioc.key.TypeKey;
import colesico.framework.ioc.production.InstanceProducingException;

@Genstamp(
        generator = "colesico.framework.ioc.codegen.generator.IocletGenerator",
        timestamp = "2020-05-28T17:54:26.586Z",
        hashId = "92e0ca2a-82df-4967-991c-aba34e2130ec",
        comments = "Producer: ClassElement{originElement=colesico.framework.httpserver.internal.HttpServerProducer}"
)
public final class HttpServerIoclet implements Ioclet {
    private final LazySingleton producer = new LazySingleton() {
        @Override
        public final HttpServerProducer create() {
            return new HttpServerProducer();
        }
    };

    @Override
    public final String getId() {
        return "colesico.framework.httpserver.internal.HttpServerProducer";
    }

    /**
     * Factory to produce colesico.framework.httpserver.ErrorHandler class instance
     * Scope: UNSCOPED; Custom: null
     */
    public Factory getDefaultErrorHandlerFactory0() {
        return new Factory() {
            private Factory implFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.httpserver.ErrorHandler
                this.implFac = ioc.factory(new TypeKey(DefaultErrorHandler.class));
            }

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

    /**
     * Factory to produce colesico.framework.httpserver.DefaultErrorHandler class instance
     * Scope: SINGLETON; Custom: null
     */
    public Factory getDefaultErrorHandlerFactory1() {
        return new SingletonFactory() {
            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.httpserver.DefaultErrorHandler
            }

            @Override
            public final DefaultErrorHandler create(final Object message) {
                try {
                    // Perform instance producing
                    DefaultErrorHandler instance = new DefaultErrorHandler();
                    // Post construct listeners invocations:
                    return instance;
                } catch (InstanceProducingException ipe) {
                    throw ipe;
                } catch (Throwable t) {
                    throw new InstanceProducingException(t, DefaultErrorHandler.class);
                }
            }
        };
    }

    @Override
    public final void addFactories(final Catalog catalog) {
        if(catalog.accept(new TypeKey("colesico.framework.httpserver.ErrorHandler"), null, null, false)){
            catalog.add(getDefaultErrorHandlerFactory0());
        }

        if(catalog.accept(new TypeKey("colesico.framework.httpserver.DefaultErrorHandler"), null, null, false)){
            catalog.add(getDefaultErrorHandlerFactory1());
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy