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

colesico.framework.resource.internal.ResourceIoclet Maven / Gradle / Ivy

Go to download

Colesico framework resource services provides ability of resource rewriting and localization

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

import colesico.framework.assist.LazySingleton;
import colesico.framework.assist.codegen.Genstamp;
import colesico.framework.ioc.TypeKey;
import colesico.framework.ioc.ioclet.AdvancedIoc;
import colesico.framework.ioc.ioclet.Catalog;
import colesico.framework.ioc.ioclet.DefaultPolysupplier;
import colesico.framework.ioc.ioclet.DefaultProvider;
import colesico.framework.ioc.ioclet.Factory;
import colesico.framework.ioc.ioclet.Ioclet;
import colesico.framework.ioc.ioclet.SingletonFactory;
import colesico.framework.profile.Profile;
import colesico.framework.profile.ProfileConfig;
import colesico.framework.resource.ResourceConfig;
import colesico.framework.resource.ResourceKit;

@Genstamp(
        generator = "colesico.framework.ioc.codegen.generator.IocletGenerator",
        timestamp = "2019-09-29T11:21:01.818Z",
        hashId = "15dd97ad-44b1-411d-9c5e-0407619f30be",
        comments = "Producer: ClassElement{originElement=colesico.framework.resource.internal.ResourceProducer}"
)
public final class ResourceIoclet implements Ioclet {
    private final LazySingleton producer = new LazySingleton() {
        @Override
        public final ResourceProducer create() {
            return new ResourceProducer();
        }
    };

    @Override
    public final String getProducerId() {
        return "colesico.framework.resource.internal.ResourceProducer";
    }

    @Override
    public final String getRank() {
        return "minor";
    }

    public Factory getResourcesKitFactory0() {
        return new SingletonFactory() {
            private Factory implFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                this.implFac=ioc.factory(new TypeKey(ResourceKitImpl.class));
            }

            @Override
            public final ResourceKit create(final Object message) {
                return producer.get().getResourcesKit(this.implFac.get(message));
            }
        };
    }

    public Factory getResourceKitImplFactory1() {
        return new SingletonFactory() {
            private Factory localizingToolFac;

            private Factory rewritingToolFac;

            private Factory evaluationToolFac;

            private Factory configsFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                this.localizingToolFac=ioc.factory(new TypeKey(LocalizingTool.class));
                this.rewritingToolFac=ioc.factory(new TypeKey(RewritingTool.class));
                this.evaluationToolFac=ioc.factory(new TypeKey(EvaluationTool.class));
                this.configsFac=ioc.factoryOrNull(new TypeKey(ResourceConfig.class));
            }

            @Override
            public final ResourceKitImpl create(final Object message) {
                return new ResourceKitImpl(this.localizingToolFac.get(message),this.rewritingToolFac.get(message),this.evaluationToolFac.get(message),new DefaultPolysupplier(this.configsFac));
            }
        };
    }

    public Factory getLocalizingToolFactory2() {
        return new SingletonFactory() {
            private Factory profileProvFac;

            private Factory configFac;

            @Override
            public final void setup(final AdvancedIoc ioc) {
                this.profileProvFac=ioc.factory(new TypeKey(Profile.class));
                this.configFac=ioc.factory(new TypeKey(ProfileConfig.class));
            }

            @Override
            public final LocalizingTool create(final Object message) {
                return new LocalizingTool(new DefaultProvider(this.profileProvFac,message),this.configFac.get(message));
            }
        };
    }

    public Factory getRewritingToolFactory3() {
        return new SingletonFactory() {
            @Override
            public final void setup(final AdvancedIoc ioc) {
            }

            @Override
            public final RewritingTool create(final Object message) {
                return new RewritingTool();
            }
        };
    }

    public Factory getEvaluationToolFactory4() {
        return new SingletonFactory() {
            @Override
            public final void setup(final AdvancedIoc ioc) {
            }

            @Override
            public final EvaluationTool create(final Object message) {
                return new EvaluationTool();
            }
        };
    }

    @Override
    public final void addFactories(final Catalog catalog) {
        if(catalog.accept(Catalog.Entry.of(new TypeKey("colesico.framework.resource.ResourceKit"),false))){
            catalog.add(getResourcesKitFactory0());
        }

        if(catalog.accept(Catalog.Entry.of(new TypeKey("colesico.framework.resource.internal.ResourceKitImpl"),false))){
            catalog.add(getResourceKitImplFactory1());
        }

        if(catalog.accept(Catalog.Entry.of(new TypeKey("colesico.framework.resource.internal.LocalizingTool"),false))){
            catalog.add(getLocalizingToolFactory2());
        }

        if(catalog.accept(Catalog.Entry.of(new TypeKey("colesico.framework.resource.internal.RewritingTool"),false))){
            catalog.add(getRewritingToolFactory3());
        }

        if(catalog.accept(Catalog.Entry.of(new TypeKey("colesico.framework.resource.internal.EvaluationTool"),false))){
            catalog.add(getEvaluationToolFactory4());
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy