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

colesico.framework.config.internal.ConfigIoclet 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.config.internal;

import colesico.framework.assist.LazySingleton;
import colesico.framework.assist.codegen.Genstamp;
import colesico.framework.config.ConfigSource;
import colesico.framework.config.PropertiesSource;
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 = "2021-06-22T11:41:34.566Z",
        hashId = "19e75603-0835-4fc2-b5da-74000641951b",
        comments = "Producer: colesico.framework.config.internal.ConfigProducer"
)
public final class ConfigIoclet implements Ioclet {
    private final LazySingleton producer = new LazySingleton() {
        @Override
        public final ConfigProducer create() {
            return new ConfigProducer();
        }
    };

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

    /**
     * Factory to produce colesico.framework.config.ConfigSource class instance
     * Scope: SINGLETON; Custom: null
     */
    public Factory getDefaultConfigSourceFactory0() {
        return new SingletonFactory() {
            private Factory implFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                // Initialize dependencies for: colesico.framework.config.ConfigSource
                this.implFac = ioc.factory(new TypeKey("colesico.framework.config.PropertiesSource"));
            }

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

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

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

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

        if(catalog.accept(new TypeKey("colesico.framework.config.PropertiesSource"), null, null, false)){
            catalog.add(getPropertiesSourceFactory1());
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy