/** * 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"); }
public ComponentMonitor currentMonitor() { if ( delegate instanceof ComponentMonitorStrategy ){ return ((ComponentMonitorStrategy)delegate).currentMonitor(); } else { return delegate; } }
/** * 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"); }
/** * 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"); }