ExtensionComponentAdapter implements LoadingOrder.Orderable, AssignableToComponentAdapter { @Override public Object getComponentInstance(final PicoContainer container) throws PicoException, ProcessCanceledException { if (myComponentInstance == null) { try { if (Element.class.equals(getComponentImplementation())) { myComponentInstance = myExtensionElement; } else { Object componentInstance = getDelegate().getComponentInstance(container); if (myDeserializeInstance) { try { XmlSerializer.deserializeInto(componentInstance, myExtensionElement); } catch (Exception e) { throw new PicoInitializationException(e); } } myComponentInstance = componentInstance; } } catch (ProcessCanceledException e) { throw e; } catch (Throwable t) { PluginId pluginId = myPluginDescriptor != null ? myPluginDescriptor.getPluginId() : null; throw new PicoPluginExtensionInitializationException(t.getMessage(), t, pluginId); } if (myComponentInstance instanceof PluginAware) { PluginAware pluginAware = (PluginAware)myComponentInstance; pluginAware.setPluginDescriptor(myPluginDescriptor); } } return myComponentInstance; } ExtensionComponentAdapter(@NotNull String implementationClass,
                                   Element extensionElement,
                                   PicoContainer container,
                                   PluginDescriptor pluginDescriptor,
                                   boolean deserializeInstance); @Override Object getComponentKey(); @Override Class getComponentImplementation(); @Override Object getComponentInstance(final PicoContainer container); @Override void verify(PicoContainer container); @Override void accept(PicoVisitor visitor); Object getExtension(); @Override LoadingOrder getOrder(); @Override String getOrderId(); @Override Element getDescribingElement(); PluginId getPluginName(); PluginDescriptor getPluginDescriptor(); @Override String getAssignableToClassName(); boolean isNotificationSent(); void setNotificationSent(boolean notificationSent); @Override String toString(); static final ExtensionComponentAdapter[] EMPTY_ARRAY; }
@Test public void testUnknownAttributes() { String name = TestExtensionClassOne.class.getName(); Element element = readElement("<bean implementation=\"123\"/>"); DefaultPicoContainer container = new DefaultPicoContainer(); DefaultPluginDescriptor descriptor = new DefaultPluginDescriptor("test"); new ExtensionComponentAdapter(name, element, container, descriptor, false).getComponentInstance(container); }