org.picocontainer.gems.lifecycle
Class ReflectionLifecycleStrategy

java.lang.Object
  extended by org.picocontainer.defaults.AbstractMonitoringLifecycleStrategy
      extended by org.picocontainer.gems.lifecycle.ReflectionLifecycleStrategy
All Implemented Interfaces:
Serializable, ComponentMonitorStrategy, LifecycleStrategy

public class ReflectionLifecycleStrategy
extends AbstractMonitoringLifecycleStrategy

Reflection lifecycle strategy. Starts, stops, disposes of component if appropriate methods are present. The component may implement only one of the three methods.

Since:
1.2
Author:
Paul Hammant, Mauro Talevi, Jörg Schaible
See Also:
Startable, Disposable, DefaultLifecycleStrategy, Serialized Form

Constructor Summary
ReflectionLifecycleStrategy(ComponentMonitor monitor)
          Construct a ReflectionLifecycleStrategy.
ReflectionLifecycleStrategy(ComponentMonitor monitor, String startMethodName, String stopMethodName, String disposeMethodName)
          Construct a ReflectionLifecycleStrategy with individual method names.
 
Method Summary
 void dispose(Object component)
           
 boolean hasLifecycle(Class type)
           The component has a lifecylce if at least one of the three methods is present.
 void start(Object component)
           
 void stop(Object component)
           
 
Methods inherited from class org.picocontainer.defaults.AbstractMonitoringLifecycleStrategy
changeMonitor, currentMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionLifecycleStrategy

public ReflectionLifecycleStrategy(ComponentMonitor monitor)
Construct a ReflectionLifecycleStrategy.

Parameters:
monitor - the monitor to use
Throws:
NullPointerException - if the monitor is null

ReflectionLifecycleStrategy

public ReflectionLifecycleStrategy(ComponentMonitor monitor,
                                   String startMethodName,
                                   String stopMethodName,
                                   String disposeMethodName)
Construct a ReflectionLifecycleStrategy with individual method names. Note, that a lifecycle method does not have any arguments.

Parameters:
monitor - the monitor to use
startMethodName - the name of the start method
stopMethodName - the name of the stop method
disposeMethodName - the name of the dispose method
Throws:
NullPointerException - if the monitor is null
Method Detail

start

public void start(Object component)

stop

public void stop(Object component)

dispose

public void dispose(Object component)

hasLifecycle

public boolean hasLifecycle(Class type)
The component has a lifecylce if at least one of the three methods is present.



Copyright © 2003-2010 Codehaus. All Rights Reserved.