Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.CollectionComponentParameter


        //      START SNIPPET: ensureCollection

        pico.registerComponentImplementation(Shark.class);
        pico.registerComponentImplementation(Cod.class);
        pico.registerComponentImplementation(Bowl.class, Bowl.class, new Parameter[]{
                new CollectionComponentParameter(Fish.class, false), new CollectionComponentParameter(Cod.class, false)});
        // This component will match both arguments of Bowl's constructor
        pico.registerComponentInstance(new LinkedList());

        Bowl bowl = (Bowl) pico.getComponentInstance(Bowl.class);
        //      END SNIPPET: ensureCollection
View Full Code Here


        //      START SNIPPET: ensureArray

        pico.registerComponentImplementation(Shark.class);
        pico.registerComponentImplementation(Cod.class);
        Parameter parameter = new CollectionComponentParameter();
        pico.registerComponentImplementation(Bowl.class, Bowl.class, new Parameter[]{parameter, parameter});
        pico.registerComponentInstance(new Fish[]{});
        pico.registerComponentInstance(new Cod[]{});

        Bowl bowl = (Bowl) pico.getComponentInstance(Bowl.class);
View Full Code Here

        mpc.registerComponentImplementation("Tom", Cod.class);
        mpc.registerComponentImplementation("Dick", Cod.class);
        mpc.registerComponentImplementation("Harry", Cod.class);
        mpc.registerComponentImplementation("Sharky", Shark.class);
        mpc.registerComponentImplementation(Bowl.class, Bowl.class, new Parameter[]{
            new CollectionComponentParameter(Fish.class, false),
            new CollectionComponentParameter(Cod.class, false) {
                protected boolean evaluate(ComponentAdapter adapter) {
                    return !"Tom".equals(adapter.getComponentKey());
                }
            }
        });
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.CollectionComponentParameter

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.