Examples of registerComponent()


Examples of org.picocontainer.MutablePicoContainer.registerComponent()

        final MutablePicoContainer parent = createPicoContainer(null);
        final MutablePicoContainer child = parent.makeChildContainer();
        ComponentAdapter hashMapAdapter = parent.registerComponent(new ConstructorInjectionComponentAdapter(HashMap.class, HashMap.class));
        ComponentAdapter hashSetAdapter = parent.registerComponent(new ConstructorInjectionComponentAdapter(HashSet.class, HashSet.class));
        ComponentAdapter stringAdapter = parent.registerComponent(new InstanceComponentAdapter(String.class, "foo"));
        ComponentAdapter arrayListAdapter = child.registerComponent(new ConstructorInjectionComponentAdapter(ArrayList.class, ArrayList.class));
        Parameter componentParameter = BasicComponentParameter.BASIC_DEFAULT;
        Parameter throwableParameter = new ConstantParameter(new Throwable("bar"));
        ComponentAdapter exceptionAdapter = child.registerComponent(new ConstructorInjectionComponentAdapter(Exception.class, Exception.class, new Parameter[]{
            componentParameter,
            throwableParameter
View Full Code Here

Examples of org.picocontainer.MutablePicoContainer.registerComponent()

        ComponentAdapter hashSetAdapter = parent.registerComponent(new ConstructorInjectionComponentAdapter(HashSet.class, HashSet.class));
        ComponentAdapter stringAdapter = parent.registerComponent(new InstanceComponentAdapter(String.class, "foo"));
        ComponentAdapter arrayListAdapter = child.registerComponent(new ConstructorInjectionComponentAdapter(ArrayList.class, ArrayList.class));
        Parameter componentParameter = BasicComponentParameter.BASIC_DEFAULT;
        Parameter throwableParameter = new ConstantParameter(new Throwable("bar"));
        ComponentAdapter exceptionAdapter = child.registerComponent(new ConstructorInjectionComponentAdapter(Exception.class, Exception.class, new Parameter[]{
            componentParameter,
            throwableParameter
        }));

        List expectedList = Arrays.asList(new Object[]{
View Full Code Here

Examples of org.picocontainer.defaults.DefaultPicoContainer.registerComponent()

        MutablePicoContainer tempContainer = new DefaultPicoContainer(container);
        try
        {
            TimeService timeService = TimeServiceHelper.narrow(orb.resolve_initial_references("TimeService"));
            tempContainer.registerComponent(new CORBAObjectComponentAdapter(TimeService.class, timeService));
        } catch (Exception e)
        {
            // ignored
        }
View Full Code Here

Examples of org.picocontainer.defaults.DefaultPicoContainer.registerComponent()

    public Object getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException
    {
        final MutablePicoContainer _helperContainer = new DefaultPicoContainer(container);
        for (int i = 0; i < helperCAs_.length; ++i)
        {
            _helperContainer.registerComponent(helperCAs_[i]);
        }

        return super.getComponentInstance(_helperContainer);
    }
View Full Code Here

Examples of org.picocontainer.defaults.DefaultPicoContainer.registerComponent()

     */
    public void testInstanceIsBorged() {
        final MutablePicoContainer mpc = new DefaultPicoContainer();
        final ComponentAdapter componentAdapter = new CachingComponentAdapter(new ConstructorInjectionComponentAdapter(
                CompatibleTouchable.class, CompatibleTouchable.class));
        mpc.registerComponent(new AssimilatingComponentAdapter(Touchable.class, componentAdapter));
        final CompatibleTouchable compatibleTouchable = (CompatibleTouchable) componentAdapter
                .getComponentInstance(mpc);
        final Touchable touchable = (Touchable) mpc.getComponentInstanceOfType(Touchable.class);
        assertFalse(compatibleTouchable.wasTouched());
        touchable.touch();
View Full Code Here

Examples of org.picocontainer.defaults.DefaultPicoContainer.registerComponent()

     */
    public void testComponentKeyIsPreserved() {
        final MutablePicoContainer mpc = new DefaultPicoContainer();
        final ComponentAdapter componentAdapter = new CachingComponentAdapter(new ConstructorInjectionComponentAdapter(
                "Touchy", CompatibleTouchable.class));
        mpc.registerComponent(new AssimilatingComponentAdapter(Touchable.class, componentAdapter));
        final CompatibleTouchable compatibleTouchable = (CompatibleTouchable) componentAdapter
                .getComponentInstance(mpc);
        final Touchable touchable = (Touchable) mpc.getComponentInstance("Touchy");
        assertFalse(compatibleTouchable.wasTouched());
        touchable.touch();
View Full Code Here

Examples of org.picocontainer.defaults.DefaultPicoContainer.registerComponent()

    /**
     * Test if proxy generation is omitted, if types are compatible.
     */
    public void testAvoidUnnecessaryProxy() {
        final MutablePicoContainer mpc = new DefaultPicoContainer();
        mpc.registerComponent(new AssimilatingComponentAdapter(TestCase.class, new InstanceComponentAdapter(TestCase.class, this)));
        final TestCase self = (TestCase) mpc.getComponentInstanceOfType(TestCase.class);
        assertFalse(Proxy.isProxyClass(self.getClass()));
        assertSame(this, self);
    }

View Full Code Here

Examples of org.picocontainer.defaults.DefaultPicoContainer.registerComponent()

    /**
     * Test if proxy generation is omitted, if types are compatible and that the component key is not changed.
     */
    public void testAvoidedProxyDoesNotChangeComponentKey() {
        final MutablePicoContainer mpc = new DefaultPicoContainer();
        mpc.registerComponent(new AssimilatingComponentAdapter(TestCase.class, new InstanceComponentAdapter(getClass(), this)));
        final TestCase self = (TestCase) mpc.getComponentInstance(getClass());
        assertNotNull(self);
        assertSame(this, self);
    }
   
View Full Code Here

Examples of org.tools.ui.ComponentMover.registerComponent()

            ComponentMover cm = new ComponentMover();
            cm.setDragInsets(insets);
            insets = new Insets(-100, -100, -100, -100);
            cm.setEdgeInsets(insets);
            cm.registerComponent(frame);
        }

        final Timer timer = new Timer(2_000, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
View Full Code Here

Examples of org.tools.ui.ComponentResizer.registerComponent()

        if (!fullscreen) {

            Insets insets = new Insets(0, 10, 10, 10);
            Dimension snap = new Dimension(10, 10);
            ComponentResizer resizer = new ComponentResizer(insets, snap);
            resizer.registerComponent(frame);

            ComponentMover cm = new ComponentMover();
            cm.setDragInsets(insets);
            insets = new Insets(-100, -100, -100, -100);
            cm.setEdgeInsets(insets);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.