Package com.github.overengineer.container.module

Examples of com.github.overengineer.container.module.Module


        LOG.info("Container verified.");
    }

    @Override
    public <M extends Module> Container loadModule(Class<M> moduleClass) {
        Module module = strategyFactory.create(moduleClass, Qualifier.NONE, Scopes.PROTOTYPE).get(this);
        for (Mapping<?> mapping : module.getMappings()) {
            Class<?> implementationType = mapping.getImplementationType();
            Object qualifier = mapping.getQualifier();
            if (qualifier.equals(Qualifier.NONE)) {
                qualifier = metadataAdapter.getQualifier(implementationType, implementationType.getAnnotations());
            }
            if (mapping instanceof InstanceMapping) {
                InstanceMapping<?> instanceMapping = (InstanceMapping) mapping;
                Object instance = instanceMapping.getInstance();
                for (Class<?> target : mapping.getTargetClasses()) {
                    addMapping(Locksmith.makeKey(target, qualifier), instance);
                }
                for (Key<?> targetGeneric : mapping.getTargetKeys()) {
                    addMapping(targetGeneric, instance);
                }
            } else {
                for (Class<?> target : mapping.getTargetClasses()) {
                    addMapping(Locksmith.makeKey(target, qualifier), implementationType, mapping.getScope());
                }
                for (Key<?> targetGeneric : mapping.getTargetKeys()) {
                    addMapping(targetGeneric, implementationType, mapping.getScope());
                }
            }
        }
        for (Map.Entry<Key, Class> entry : module.getNonManagedComponentFactories().entrySet()) {
            registerNonManagedComponentFactory(entry.getKey(), entry.getValue());
        }
        return this;
    }
View Full Code Here

TOP

Related Classes of com.github.overengineer.container.module.Module

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.