|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.defaults.DecoratingComponentAdapter
public class DecoratingComponentAdapter
Component adapter which decorates another adapter.
This adapter supports a component monitor strategy
and will propagate change of monitor to the delegate if the delegate itself
support the monitor strategy.
This adapter also supports a lifecycle manager
and a
lifecycle strategy
if the delegate does.
Field Summary | |
---|---|
private ComponentAdapter |
delegate
|
Constructor Summary | |
---|---|
DecoratingComponentAdapter(ComponentAdapter delegate)
|
Method Summary | |
---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter. |
void |
changeMonitor(ComponentMonitor monitor)
Delegates change of monitor if the delegate supports a component monitor strategy. |
ComponentMonitor |
currentMonitor()
Returns delegate's current monitor if the delegate supports a component monitor strategy. |
void |
dispose(java.lang.Object component)
Invokes delegate dispose method if the delegate is a LifecycleStrategy Invoke the "dispose" method on the component instance if this is disposable. |
void |
dispose(PicoContainer container)
Invokes delegate dispose method if the delegate is a LifecycleManager Invoke the "dispose" method on the container's components. |
java.lang.Class |
getComponentImplementation()
Retrieve the class of the component. |
java.lang.Object |
getComponentInstance(PicoContainer container)
Retrieve the component instance. |
java.lang.Object |
getComponentKey()
Retrieve the key associated with the component. |
ComponentAdapter |
getDelegate()
|
private java.lang.String |
getPrintableClassName()
|
boolean |
hasLifecycle()
Invokes delegate hasLifecylce method if the delegate is a LifecycleManager Test if a container's component has a lifecycle. |
boolean |
hasLifecycle(java.lang.Class type)
Invokes delegate hasLifecylce(Class) method if the delegate is a LifecycleStrategy Test if a component instance has a lifecycle. |
void |
start(java.lang.Object component)
Invokes delegate start method if the delegate is a LifecycleStrategy Invoke the "start" method on the component instance if this is startable. |
void |
start(PicoContainer container)
Invokes delegate start method if the delegate is a LifecycleManager Invoke the "start" method on the container's components. |
void |
stop(java.lang.Object component)
Invokes delegate stop method if the delegate is a LifecycleStrategy Invoke the "stop" method on the component instance if this is stoppable. |
void |
stop(PicoContainer container)
Invokes delegate stop method if the delegate is a LifecycleManager Invoke the "stop" method on the container's components. |
java.lang.String |
toString()
|
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisifed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ComponentAdapter delegate
Constructor Detail |
---|
public DecoratingComponentAdapter(ComponentAdapter delegate)
Method Detail |
---|
public java.lang.Object getComponentKey()
ComponentAdapter
getComponentKey
in interface ComponentAdapter
public java.lang.Class getComponentImplementation()
ComponentAdapter
getComponentImplementation
in interface ComponentAdapter
public java.lang.Object getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException
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.
PicoInitializationException
- if the component could not be instantiated.
PicoIntrospectionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambigous situation within the
container.public void verify(PicoContainer container) throws PicoIntrospectionException
ComponentAdapter
verify
in interface ComponentAdapter
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.
PicoIntrospectionException
- if one or more dependencies cannot be resolved.public ComponentAdapter getDelegate()
public void accept(PicoVisitor visitor)
ComponentAdapter
PicoContainer
, that
cascades the visitor also down to all its ComponentAdapter instances.
accept
in interface ComponentAdapter
visitor
- the visitor.public void changeMonitor(ComponentMonitor monitor)
changeMonitor
in interface ComponentMonitorStrategy
monitor
- the new ComponentMonitor to usepublic ComponentMonitor currentMonitor()
currentMonitor
in interface ComponentMonitorStrategy
PicoIntrospectionException
- if no component monitor is found in delegatepublic void start(PicoContainer container)
start
in interface LifecycleManager
container
- the container to "start" its components' lifecyclepublic void stop(PicoContainer container)
stop
in interface LifecycleManager
container
- the container to "stop" its components' lifecyclepublic void dispose(PicoContainer container)
dispose
in interface LifecycleManager
container
- the container to "dispose" its components' lifecyclepublic boolean hasLifecycle()
hasLifecycle
in interface LifecycleManager
true
if the component has a lifecyclepublic void start(java.lang.Object component)
start
in interface LifecycleStrategy
component
- the instance of the component to startpublic void stop(java.lang.Object component)
stop
in interface LifecycleStrategy
component
- the instance of the component to stoppublic void dispose(java.lang.Object component)
dispose
in interface LifecycleStrategy
component
- the instance of the component to disposepublic boolean hasLifecycle(java.lang.Class type)
hasLifecycle
in interface LifecycleStrategy
type
- the component's type
true
if the component has a lifecyclepublic java.lang.String toString()
toString
in class java.lang.Object
private java.lang.String getPrintableClassName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |