Class Cached<T>

  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>, ComponentLifecycle<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.

Mauro Talevi
See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class org.picocontainer.behaviors.Stored
Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter
Field Summary
Fields inherited from class org.picocontainer.behaviors.AbstractBehavior
Constructor Summary
Cached(ComponentAdapter delegate)
Cached(ComponentAdapter delegate, ObjectReference<Stored.Instance<T>> instanceReference)
Method Summary
 String getDescriptor()
          Get a string key descriptor of the component adapter for use in toString()
Methods inherited from class org.picocontainer.behaviors.Stored
componentHasLifecycle, dispose, flush, getComponentInstance, getLifecycleDescriptor, getStoredObject, isStarted, start, stop
Methods inherited from class org.picocontainer.behaviors.AbstractBehavior
accept, changeMonitor, currentMonitor, dispose, findAdapterOfType, getComponentImplementation, getComponentInstance, getComponentKey, getDelegate, hasLifecycle, isLazy, start, stop, toString, verify
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public Cached(ComponentAdapter delegate)


public Cached(ComponentAdapter delegate,
              ObjectReference<Stored.Instance<T>> instanceReference)
Method Detail


public String getDescriptor()
Description copied from interface: ComponentAdapter
Get a string key descriptor of the component adapter for use in toString()

Specified by:
getDescriptor in interface ComponentAdapter<T>
getDescriptor in class Stored<T>
the descriptor

Copyright © 2003-2010 Codehaus. All Rights Reserved.