Package org.picocontainer.containers

Examples of org.picocontainer.containers.TransientPicoContainer


        }, threads).run(duration, primingRuns, "my container creation");

        long picos = new ConcurrentExecutionAssistant.TestThreadGroup(new ConcurrentExecutionAssistant.Execution() {
            @Override
            public void execute() throws HotSwapException {
                new TransientPicoContainer()
                        .addComponent(IBean.class, Bean.class)
                        .addComponent(IBean2.class, Bean2.class)
                        .getComponent(IBean.class);
            }
        }, threads).run(duration, primingRuns, "pico container creation");
View Full Code Here


        return this;
    }

    public MutablePicoContainer build() {

        DefaultPicoContainer tempContainer = new TransientPicoContainer();
        tempContainer.addComponent(PicoContainer.class, parentContainer);

        addContainerComponents(tempContainer);

        ComponentFactory lastCaf = injectionType;
        while (!componentFactories.empty()) {
            lastCaf = buildComponentFactory(tempContainer, lastCaf);
        }

        tempContainer.addComponent(ComponentFactory.class, lastCaf);

        buildComponentMonitor(tempContainer);

        tempContainer.addComponent(LifecycleStrategy.class, lifecycleStrategyClass);
        tempContainer.addComponent("mpc", mpcClass);

        MutablePicoContainer newContainer = (MutablePicoContainer) tempContainer.getComponent("mpc");

        addChildToParent(newContainer);
        return newContainer;
    }
View Full Code Here

        }
    }

    private ComponentFactory buildComponentFactory(DefaultPicoContainer container, final ComponentFactory lastCaf) {
        Object componentFactory = componentFactories.pop();
        DefaultPicoContainer tmpContainer = new TransientPicoContainer(container);
        tmpContainer.addComponent("componentFactory", componentFactory);
        if (lastCaf != null) {
            tmpContainer.addComponent(ComponentFactory.class, lastCaf);
        }
        ComponentFactory newlastCaf = (ComponentFactory) tmpContainer.getComponent("componentFactory");
        if (newlastCaf instanceof BehaviorFactory) {
            ((BehaviorFactory) newlastCaf).wrap(lastCaf);
        }
        return newlastCaf;
    }
View Full Code Here

TOP

Related Classes of org.picocontainer.containers.TransientPicoContainer

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.