/** * Creates a new container with a custom ComponentAdapterFactory and a * parent container. * <p/> * <em> * Important note about caching: If you intend the components to be cached, you should pass * in a factory that creates {@link CachingComponentAdapter} instances, such as for example * {@link CachingComponentAdapterFactory}. CachingComponentAdapterFactory can delegate to * other ComponentAdapterFactories. * </em> * * @param componentAdapterFactory * the factory to use for creation of ComponentAdapters. * @param parent * the parent container (used for component dependency lookups). */ public JdonPicoContainer(ComponentAdapterFactory componentAdapterFactory, PicoContainer parent) { if (componentAdapterFactory == null) throw new NullPointerException("componentAdapterFactory"); this.componentAdapterFactory = componentAdapterFactory; this.parent = parent == null ? null : ImmutablePicoContainerProxyFactory.newProxyInstance(parent); }
/** * Creates a new container with a custom ComponentAdapterFactory, LifecycleStrategy for instance registration, * and a parent container. * <p/> * <em> * Important note about caching: If you intend the components to be cached, you should pass * in a factory that creates {@link CachingComponentAdapter} instances, such as for example * {@link CachingComponentAdapterFactory}. CachingComponentAdapterFactory can delegate to * other ComponentAdapterFactories. * </em> * * @param componentAdapterFactory the factory to use for creation of ComponentAdapters. * @param lifecycleStrategyForInstanceRegistrations the lifecylce strategy chosen for regiered * instance (not implementations!) * @param parent the parent container (used for component dependency lookups). */ public DefaultPicoContainer(ComponentAdapterFactory componentAdapterFactory, LifecycleStrategy lifecycleStrategyForInstanceRegistrations, PicoContainer parent) { if (componentAdapterFactory == null) throw new NullPointerException("componentAdapterFactory"); if (lifecycleStrategyForInstanceRegistrations == null) throw new NullPointerException("lifecycleStrategyForInstanceRegistrations"); this.componentAdapterFactory = componentAdapterFactory; this.lifecycleStrategyForInstanceRegistrations = lifecycleStrategyForInstanceRegistrations; this.parent = parent == null ? null : ImmutablePicoContainerProxyFactory.newProxyInstance(parent); }