public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final Class<? extends Annotation> binding) { for (PicoContainer container : containers) { ComponentAdapter<T> inst = container.getComponentAdapter(componentType, binding); if (inst != null) { return inst; } } return null; }
public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final NameBinding nameBinding) { for (PicoContainer container : containers) { ComponentAdapter<T> inst = container.getComponentAdapter(componentType, nameBinding); if (inst != null) { return inst; } } return null; }
public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final Class<? extends Annotation> binding) { for (PicoContainer container : containers) { ComponentAdapter<T> inst = container.getComponentAdapter(componentType, binding); if (inst != null) { return inst; } } return null; }
public ComponentAdapter getComponentAdapter(final Object key) { for (PicoContainer container : containers) { ComponentAdapter inst = container.getComponentAdapter(key); if (inst != null) { return inst; } } return null; }
public ComponentAdapter getComponentAdapter(final Object key) { for (PicoContainer container : containers) { ComponentAdapter inst = container.getComponentAdapter(key); if (inst != null) { return inst; } } return null; }
public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final NameBinding nameBinding) { for (PicoContainer container : containers) { ComponentAdapter<T> inst = container.getComponentAdapter(componentType, nameBinding); if (inst != null) { return inst; } } return null; }
public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final NameBinding componentNameBinding) { return delegate.getComponentAdapter(componentType, componentNameBinding); }
public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final NameBinding componentNameBinding) { return delegate.getComponentAdapter(componentType, componentNameBinding); }
public ComponentAdapter<?> getComponentAdapter(final Object key) { return delegate.getComponentAdapter(key); }
public ComponentAdapter<?> getComponentAdapter(final Object key) { return delegate.getComponentAdapter(key); }
public <T> ComponentAdapter<T> getComponentAdapter(final Generic<T> componentType, final Class<? extends Annotation> binding) { return delegate.getComponentAdapter(componentType, binding); }
public <T> ComponentAdapter<T> getComponentAdapter(final Class<T> componentType, final NameBinding nameBinding) { for (PicoContainer container : containers) { ComponentAdapter<T> inst = container.getComponentAdapter(Generic.get(componentType), nameBinding); if (inst != null) { return inst; } } return null; }
public <T> ComponentAdapter<T> getComponentAdapter(final Class<T> componentType, final NameBinding nameBinding) { for (PicoContainer container : containers) { ComponentAdapter<T> inst = container.getComponentAdapter(Generic.get(componentType), nameBinding); if (inst != null) { return inst; } } return null; }
public <T> ComponentAdapter<T> getComponentAdapter(final Class<T> componentType, final Class<? extends Annotation> binding) { return delegate.getComponentAdapter(Generic.get(componentType), binding); }
public <T> ComponentAdapter<T> getComponentAdapter(final Class<T> componentType, final NameBinding nameBinding) { return delegate.getComponentAdapter(Generic.get(componentType), nameBinding); }
private <T> ComponentAdapter<T> noMatchingAdaptersFound(final PicoContainer container, final Generic<T> expectedType, final NameBinding expectedNameBinding, final Annotation binding) { if (container.getParent() != null) { if (binding != null) { return container.getParent().getComponentAdapter(expectedType, binding.getClass()); } else { return container.getParent().getComponentAdapter(expectedType, expectedNameBinding); } } else { return null; } }
private <T> ComponentAdapter<T> noMatchingAdaptersFound(final PicoContainer container, final Generic<T> expectedType, final NameBinding expectedNameBinding, final Annotation binding) { if (container.getParent() != null) { if (binding != null) { return container.getParent().getComponentAdapter(expectedType, binding.getClass()); } else { return container.getParent().getComponentAdapter(expectedType, expectedNameBinding); } } else { return null; } }
@Override public Class<?> getType(ELContext context, Object base, Object property) { if (base == null) { ComponentAdapter<?> result = getPicoContainer(context).getComponentAdapter(property); if (result != null) { context.setPropertyResolved(true); return result.getComponentImplementation(); } } return null; }
@Test public void testBasicInstantiationAndContainment() throws PicoException { PicoContainer pico = createPicoContainerWithTouchableAndDependsOnTouchable(); assertTrue("Component should be instance of Touchable", Touchable.class.isAssignableFrom(pico.getComponentAdapter(Touchable.class, (NameBinding) null).getComponentImplementation())); }
@Test public void testRegisteredComponentsExistAndAreTheCorrectTypes() throws PicoException { PicoContainer pico = createPicoContainerWithTouchableAndDependsOnTouchable(); assertNotNull("Container should have Touchable addComponent", pico.getComponentAdapter(Touchable.class, (NameBinding) null)); assertNotNull("Container should have DependsOnTouchable addComponent", pico.getComponentAdapter(DependsOnTouchable.class, (NameBinding) null)); assertTrue("Component should be instance of Touchable", pico.getComponent(Touchable.class) != null); assertTrue("Component should be instance of DependsOnTouchable", pico.getComponent(DependsOnTouchable.class) != null); assertNull("should not have non existent addComponent", pico.getComponentAdapter(Map.class, (NameBinding) null)); }