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

colesico.framework.http.internal.HttpIoclet Maven / Gradle / Ivy

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

import colesico.framework.assist.LazySingleton;
import colesico.framework.assist.codegen.Genstamp;
import colesico.framework.http.HttpContext;
import colesico.framework.http.HttpRequest;
import colesico.framework.http.HttpResponse;
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.production.InstanceProducingException;
import colesico.framework.ioc.scope.ThreadScope;

@Genstamp(
        generator = "colesico.framework.ioc.codegen.generator.IocletGenerator",
        timestamp = "2020-07-24T10:48:51.796Z",
        hashId = "1b3ce46a-4f51-430c-b111-e57c6121ab22",
        comments = "Producer: ClassElement{originElement=colesico.framework.http.internal.HttpProducer}"
)
public final class HttpIoclet implements Ioclet {
    private final LazySingleton producer = new LazySingleton() {
        @Override
        public final HttpProducer create() {
            return new HttpProducer();
        }
    };

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

    /**
     * Factory to produce colesico.framework.http.HttpContext class instance
     * Scope: UNSCOPED; Custom: null
     */
    public Factory getHttpContextFactory0() {
        return new Factory() {
            private Factory scopeFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.http.HttpContext
                this.scopeFac = ioc.factory(new TypeKey("colesico.framework.ioc.scope.ThreadScope"));
            }

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

    /**
     * Factory to produce colesico.framework.http.HttpRequest class instance
     * Scope: UNSCOPED; Custom: null
     */
    public Factory getHttpRequestFactory1() {
        return new Factory() {
            private Factory ctxFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.http.HttpRequest
                this.ctxFac = ioc.factory(new TypeKey("colesico.framework.http.HttpContext"));
            }

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

    /**
     * Factory to produce colesico.framework.http.HttpResponse class instance
     * Scope: UNSCOPED; Custom: null
     */
    public Factory getHttpResponseFactory2() {
        return new Factory() {
            private Factory ctxFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.http.HttpResponse
                this.ctxFac = ioc.factory(new TypeKey("colesico.framework.http.HttpContext"));
            }

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

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

        if(catalog.accept(new TypeKey("colesico.framework.http.HttpRequest"), null, null, false)){
            catalog.add(getHttpRequestFactory1());
        }

        if(catalog.accept(new TypeKey("colesico.framework.http.HttpResponse"), null, null, false)){
            catalog.add(getHttpResponseFactory2());
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy