/** * Changes monitor in the ComponentAdapterFactory, the component adapters * and the child containers, if these support a ComponentMonitorStrategy. * {@inheritDoc} */ public void changeMonitor(ComponentMonitor monitor) { // will also change monitor in lifecycleStrategyForInstanceRegistrations if (componentAdapterFactory instanceof ComponentMonitorStrategy) { ((ComponentMonitorStrategy) componentAdapterFactory).changeMonitor(monitor); } for (Iterator i = compAdapters.iterator(); i.hasNext();) { Object adapter = i.next(); if (adapter instanceof ComponentMonitorStrategy) { ((ComponentMonitorStrategy) adapter).changeMonitor(monitor); } } for (Iterator i = children.iterator(); i.hasNext();) { Object child = i.next(); if (child instanceof ComponentMonitorStrategy) { ((ComponentMonitorStrategy) child).changeMonitor(monitor); } } }
/** * Returns the first current monitor found in the ComponentAdapterFactory, * the component adapters and the child containers, if these support a * ComponentMonitorStrategy. {@inheritDoc} * * @throws PicoIntrospectionException * if no component monitor is found in container or its children */ public ComponentMonitor currentMonitor() { if (componentAdapterFactory instanceof ComponentMonitorStrategy) { return ((ComponentMonitorStrategy) componentAdapterFactory).currentMonitor(); } for (Iterator i = compAdapters.iterator(); i.hasNext();) { Object adapter = i.next(); if (adapter instanceof ComponentMonitorStrategy) { return ((ComponentMonitorStrategy) adapter).currentMonitor(); } } for (Iterator i = children.iterator(); i.hasNext();) { Object child = i.next(); if (child instanceof ComponentMonitorStrategy) { return ((ComponentMonitorStrategy) child).currentMonitor(); } } throw new PicoIntrospectionException("No component monitor found in container or its children"); }
/** * Delegates change of monitor if the delegate supports * a component monitor strategy. * {@inheritDoc} */ public void changeMonitor(ComponentMonitor monitor) { if ( delegate instanceof ComponentMonitorStrategy ){ ((ComponentMonitorStrategy)delegate).changeMonitor(monitor); } }
public ComponentMonitor currentMonitor() { if ( delegate instanceof ComponentMonitorStrategy ){ return ((ComponentMonitorStrategy)delegate).currentMonitor(); } else { return delegate; } }
public void changeMonitor(ComponentMonitor monitor) { super.changeMonitor(monitor); if (lifecycleStrategy instanceof ComponentMonitorStrategy) { ((ComponentMonitorStrategy) lifecycleStrategy).changeMonitor(monitor); } }
/** * Returns delegate's current monitor if the delegate supports * a component monitor strategy. * {@inheritDoc} * @throws PicoIntrospectionException if no component monitor is found in delegate */ public ComponentMonitor currentMonitor() { if ( delegate instanceof ComponentMonitorStrategy ){ return ((ComponentMonitorStrategy)delegate).currentMonitor(); } throw new PicoIntrospectionException("No component monitor found in delegate"); }
/** * Changes monitor in the ComponentAdapterFactory, the component adapters * and the child containers, if these support a ComponentMonitorStrategy. * {@inheritDoc} */ public void changeMonitor(ComponentMonitor monitor) { // will also change monitor in lifecycleStrategyForInstanceRegistrations if (componentAdapterFactory instanceof ComponentMonitorStrategy) { ((ComponentMonitorStrategy) componentAdapterFactory).changeMonitor(monitor); } for ( Iterator i = componentAdapters.iterator(); i.hasNext(); ){ Object adapter = i.next(); if ( adapter instanceof ComponentMonitorStrategy ) { ((ComponentMonitorStrategy)adapter).changeMonitor(monitor); } } for (Iterator i = children.iterator(); i.hasNext();) { Object child = i.next(); if (child instanceof ComponentMonitorStrategy) { ((ComponentMonitorStrategy) child).changeMonitor(monitor); } } }
/** * Returns the first current monitor found in the ComponentAdapterFactory, the component adapters * and the child containers, if these support a ComponentMonitorStrategy. * {@inheritDoc} * @throws PicoIntrospectionException if no component monitor is found in container or its children */ public ComponentMonitor currentMonitor() { if (componentAdapterFactory instanceof ComponentMonitorStrategy) { return ((ComponentMonitorStrategy) componentAdapterFactory).currentMonitor(); } for ( Iterator i = componentAdapters.iterator(); i.hasNext(); ){ Object adapter = i.next(); if ( adapter instanceof ComponentMonitorStrategy ) { return ((ComponentMonitorStrategy)adapter).currentMonitor(); } } for (Iterator i = children.iterator(); i.hasNext();) { Object child = i.next(); if (child instanceof ComponentMonitorStrategy) { return ((ComponentMonitorStrategy) child).currentMonitor(); } } throw new PicoIntrospectionException("No component monitor found in container or its children"); }
/** * If the delegate supports a {@link ComponentMonitorStrategy monitor strategy}, * this is used to changed the monitor while keeping the same delegate. * Else the delegate is replaced by the new monitor. * {@inheritDoc} */ public void changeMonitor(ComponentMonitor monitor) { checkMonitor(monitor); if ( delegate instanceof ComponentMonitorStrategy ){ ((ComponentMonitorStrategy)delegate).changeMonitor(monitor); } else { delegate = monitor; } }