|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.defaults.MonitoringComponentAdapter
org.picocontainer.defaults.AbstractComponentAdapter
org.picocontainer.defaults.InstanceComponentAdapter
public class InstanceComponentAdapter
Component adapter which wraps a component instance.
This component adapter supports both a LifecycleManager
and a
LifecycleStrategy
to control the lifecycle of the component.
The lifecycle manager methods simply delegate to the lifecycle strategy methods
on the component instance.
Field Summary | |
---|---|
private java.lang.Object |
componentInstance
|
private LifecycleStrategy |
lifecycleStrategy
|
Constructor Summary | |
---|---|
InstanceComponentAdapter(java.lang.Object componentKey,
java.lang.Object componentInstance)
|
|
InstanceComponentAdapter(java.lang.Object componentKey,
java.lang.Object componentInstance,
LifecycleStrategy lifecycleStrategy)
|
Method Summary | |
---|---|
void |
dispose(java.lang.Object component)
Invoke the "dispose" method on the component instance if this is disposable. |
void |
dispose(PicoContainer container)
Invoke the "dispose" method on the container's components. |
java.lang.Object |
getComponentInstance(PicoContainer container)
Retrieve the component instance. |
private static java.lang.Class |
getInstanceClass(java.lang.Object componentInstance)
|
boolean |
hasLifecycle()
Test if a container's component has a lifecycle. |
boolean |
hasLifecycle(java.lang.Class type)
Test if a component instance has a lifecycle. |
void |
start(java.lang.Object component)
Invoke the "start" method on the component instance if this is startable. |
void |
start(PicoContainer container)
Invoke the "start" method on the container's components. |
void |
stop(java.lang.Object component)
Invoke the "stop" method on the component instance if this is stoppable. |
void |
stop(PicoContainer container)
Invoke the "stop" method on the container's components. |
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisifed. |
Methods inherited from class org.picocontainer.defaults.AbstractComponentAdapter |
---|
accept, checkTypeCompatibility, getComponentImplementation, getComponentKey, toString |
Methods inherited from class org.picocontainer.defaults.MonitoringComponentAdapter |
---|
changeMonitor, currentMonitor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.Object componentInstance
private LifecycleStrategy lifecycleStrategy
Constructor Detail |
---|
public InstanceComponentAdapter(java.lang.Object componentKey, java.lang.Object componentInstance) throws AssignabilityRegistrationException, NotConcreteRegistrationException
AssignabilityRegistrationException
NotConcreteRegistrationException
public InstanceComponentAdapter(java.lang.Object componentKey, java.lang.Object componentInstance, LifecycleStrategy lifecycleStrategy) throws AssignabilityRegistrationException, NotConcreteRegistrationException
AssignabilityRegistrationException
NotConcreteRegistrationException
Method Detail |
---|
private static java.lang.Class getInstanceClass(java.lang.Object componentInstance)
public java.lang.Object getComponentInstance(PicoContainer container)
ComponentAdapter
CachingComponentAdapter
will always return the
same instance.
getComponentInstance
in interface ComponentAdapter
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.
public void verify(PicoContainer container)
ComponentAdapter
verify
in interface ComponentAdapter
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.public void start(PicoContainer container)
LifecycleManager
start
in interface LifecycleManager
container
- the container to "start" its components' lifecyclepublic void stop(PicoContainer container)
LifecycleManager
stop
in interface LifecycleManager
container
- the container to "stop" its components' lifecyclepublic void dispose(PicoContainer container)
LifecycleManager
dispose
in interface LifecycleManager
container
- the container to "dispose" its components' lifecyclepublic boolean hasLifecycle()
LifecycleManager
hasLifecycle
in interface LifecycleManager
true
if the component has a lifecyclepublic void start(java.lang.Object component)
LifecycleStrategy
start
in interface LifecycleStrategy
component
- the instance of the component to startpublic void stop(java.lang.Object component)
LifecycleStrategy
stop
in interface LifecycleStrategy
component
- the instance of the component to stoppublic void dispose(java.lang.Object component)
LifecycleStrategy
dispose
in interface LifecycleStrategy
component
- the instance of the component to disposepublic boolean hasLifecycle(java.lang.Class type)
LifecycleStrategy
hasLifecycle
in interface LifecycleStrategy
type
- the component's type
true
if the component has a lifecycle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |