1 /***************************************************************************** 2 * Copyright (C) PicoContainer Organization. All rights reserved. * 3 * ------------------------------------------------------------------------- * 4 * The software in this package is published under the terms of the BSD * 5 * style license a copy of which has been included with this distribution in * 6 * the LICENSE.txt file. * 7 *****************************************************************************/ 8 package org.picocontainer.defaults; 9 10 /** 11 * An interface which specifies the lifecyle strategy on the component instance. 12 * Lifecycle strategies are used by component adapters to delegate the lifecyle 13 * operations on the component instances. 14 * 15 * @author Paul Hammant 16 * @author Peter Royal 17 * @author Jörg Schaible 18 * @author Mauro Talevi 19 * @see org.picocontainer.Startable 20 * @see org.picocontainer.Disposable 21 */ 22 public interface LifecycleStrategy { 23 24 /** 25 * Invoke the "start" method on the component instance if this is startable. 26 * It is up to the implementation of the strategy what "start" and "startable" means. 27 * 28 * @param component the instance of the component to start 29 */ 30 void start(Object component); 31 32 /** 33 * Invoke the "stop" method on the component instance if this is stoppable. 34 * It is up to the implementation of the strategy what "stop" and "stoppable" means. 35 * 36 * @param component the instance of the component to stop 37 */ 38 void stop(Object component); 39 40 /** 41 * Invoke the "dispose" method on the component instance if this is disposable. 42 * It is up to the implementation of the strategy what "dispose" and "disposable" means. 43 * 44 * @param component the instance of the component to dispose 45 */ 46 void dispose(Object component); 47 48 /** 49 * Test if a component instance has a lifecycle. 50 * @param type the component's type 51 * 52 * @return <code>true</code> if the component has a lifecycle 53 */ 54 boolean hasLifecycle(Class type); 55 56 } 57