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

colesico.framework.rpc.internal.RpcRouterOptionsIoclet Maven / Gradle / Ivy

The newest version!
// This is automatically generated file. Do not modify!
package colesico.framework.rpc.internal;

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.ioclet.SingletonFactory;
import colesico.framework.ioc.key.TypeKey;
import colesico.framework.ioc.production.InstanceProducingException;
import colesico.framework.router.RouterOptions;
import colesico.framework.rpc.teleapi.RpcExchange;

@Genstamp(
        generator = "colesico.framework.ioc.codegen.generator.IocletGenerator",
        timestamp = "2023-11-27T16:00:34.549Z",
        hashId = "05eb570d-f9b2-4503-9ed8-dff5b252201e",
        comments = "Producer: colesico.framework.rpc.internal.RpcRouterOptionsProducer"
)
public final class RpcRouterOptionsIoclet implements Ioclet {
    private final LazySingleton producer = new LazySingleton() {
        @Override
        public final RpcRouterOptionsProducer create() {
            return new RpcRouterOptionsProducer();
        }
    };

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

    /**
     * Factory to produce colesico.framework.router.RouterOptions class instance
     * Scope: UNSCOPED; Custom: null
     * Polyproduce: true
     */
    public Factory getRpcRouterOptionsFactory0() {
        return new Factory() {
            private Factory configFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.router.RouterOptions
                this.configFac = ioc.factory(new TypeKey("colesico.framework.rpc.internal.RpcRouterOptions"));
            }

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

    /**
     * Factory to produce colesico.framework.rpc.internal.RpcRouterOptions class instance
     * Scope: SINGLETON; Custom: null
     */
    public Factory getRpcRouterOptionsFactory1() {
        return new SingletonFactory() {
            private Factory dispatcherFac;

            private Factory exchangeFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.rpc.internal.RpcRouterOptions
                this.dispatcherFac = ioc.factory(new TypeKey("colesico.framework.rpc.internal.RpcDispatcher"));
                this.exchangeFac = ioc.factory(new TypeKey("colesico.framework.rpc.teleapi.RpcExchange"));
            }

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

    @Override
    public final void addFactories(final Catalog catalog) {
        if(catalog.accept(new TypeKey("colesico.framework.router.RouterOptions"), null, null, true)){
            catalog.add(getRpcRouterOptionsFactory0());
        }

        if(catalog.accept(new TypeKey("colesico.framework.rpc.internal.RpcRouterOptions"), null, null, false)){
            catalog.add(getRpcRouterOptionsFactory1());
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy