org.picocontainer.behaviors
Class Cached<T>

java.lang.Object
  extended by org.picocontainer.behaviors.AbstractBehavior<T>
      extended by org.picocontainer.behaviors.Stored<T>
          extended by org.picocontainer.behaviors.Cached<T>
All Implemented Interfaces:
Serializable, Behavior<T>, ComponentAdapter<T>, ComponentMonitorStrategy, LifecycleStrategy

public class Cached<T>
extends Stored<T>

ComponentAdapter implementation that caches the component instance.

This adapter supports components with a lifecycle, as it is a lifecycle manager which will apply the delegate's lifecycle strategy to the cached component instance. The lifecycle state is maintained so that the component instance behaves in the expected way: it can't be started if already started, it can't be started or stopped if disposed, it can't be stopped if not started, it can't be disposed if already disposed.

Author:
Mauro Talevi
See Also:
Serialized Form

Nested Class Summary
static class Cached.SimpleReference<T>
           
 
Field Summary
 
Fields inherited from class org.picocontainer.behaviors.Stored
delegateHasLifecylce, disposed, instanceReference, started
 
Fields inherited from class org.picocontainer.behaviors.AbstractBehavior
delegate
 
Constructor Summary
Cached(ComponentAdapter delegate)
           
Cached(ComponentAdapter delegate, ObjectReference instanceReference)
           
 
Method Summary
 String toString()
           
 
Methods inherited from class org.picocontainer.behaviors.Stored
componentHasLifecycle, dispose, flush, getComponentInstance, start, stop
 
Methods inherited from class org.picocontainer.behaviors.AbstractBehavior
accept, changeMonitor, currentMonitor, dispose, findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate, hasLifecycle, start, stop, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cached

public Cached(ComponentAdapter delegate)

Cached

public Cached(ComponentAdapter delegate,
              ObjectReference instanceReference)
Method Detail

toString

public String toString()
Overrides:
toString in class AbstractBehavior<T>


Copyright © 2003-2007 Codehaus. All Rights Reserved.