Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.InstanceComponentAdapter


                "    component(A)\n" +
                "}");

        A a = new A();
        Mock cafMock = mock(ComponentAdapterFactory.class);
        cafMock.expects(once()).method("createComponentAdapter").with(same(A.class), same(A.class), eq(null)).will(returnValue(new InstanceComponentAdapter(A.class, a)));
        ComponentAdapterFactory componentAdapterFactory = (ComponentAdapterFactory) cafMock.proxy();
        PicoContainer pico = buildContainer(script, null, componentAdapterFactory);
        assertSame(a, pico.getComponentInstanceOfType(A.class));
    }
View Full Code Here


                "    component(A)\n" +
                "}");

        A a = new A();
        Mock cafMock = mock(ComponentAdapterFactory.class);
        cafMock.expects(once()).method("createComponentAdapter").with(same(A.class), same(A.class), eq(null)).will(returnValue(new InstanceComponentAdapter(A.class, a)));
        ComponentAdapterFactory componentAdapterFactory = (ComponentAdapterFactory) cafMock.proxy();
        PicoContainer pico = buildContainer(script, null, componentAdapterFactory);
        assertSame(a, pico.getComponentInstanceOfType(A.class));
    }
View Full Code Here

         {
            pc.unregisterComponent(contrivedKey);
         }

      }
      ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);
      registerComponent(componentAdapter);
      return componentAdapter;
   }
View Full Code Here

        if ( o instanceof Class ) {
            //TODO: determine which form of injection to use
            return new ConstructorInjectionComponentAdapter( componentKey, (Class) o );
        }
       
        return new InstanceComponentAdapter( componentKey, o );
    }
View Full Code Here

       
        if ( o instanceof Class ) {
            return new ConstructorInjectionComponentAdapter( null, (Class) o );
        }
       
        return new InstanceComponentAdapter( null, o );
    }
View Full Code Here

         {
            pc.unregisterComponent(contrivedKey);
         }

      }
      ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);
      registerComponent(componentAdapter);
      return componentAdapter;
   }
View Full Code Here

         {
            pc.unregisterComponent(contrivedKey);
         }

      }
      ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);
      registerComponent(componentAdapter);
      return componentAdapter;
   }
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.InstanceComponentAdapter

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.