Package org.picocontainer.behaviors
Class Cached<T>
- java.lang.Object
-
- org.picocontainer.behaviors.AbstractBehavior<T>
-
- org.picocontainer.behaviors.Stored<T>
-
- org.picocontainer.behaviors.Cached<T>
-
- All Implemented Interfaces:
java.io.Serializable,Behavior<T>,ComponentAdapter<T>,ComponentLifecycle<T>,ComponentMonitorStrategy,LifecycleStrategy
public class Cached<T> extends Stored<T>
ComponentAdapterimplementation that caches the component instance.This adapter supports components with a lifecycle, as it is a
lifecycle managerwhich will apply the delegate'slifecycle strategyto 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
-
Nested classes/interfaces inherited from class org.picocontainer.behaviors.Stored
Stored.Instance<T>
-
Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter
ComponentAdapter.NOTHING
-
-
Field Summary
-
Fields inherited from class org.picocontainer.behaviors.AbstractBehavior
delegate
-
-
Constructor Summary
Constructors Constructor Description Cached(ComponentAdapter delegate)Cached(ComponentAdapter delegate, ObjectReference<Stored.Instance<T>> instanceReference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescriptor()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
-
-
-
-
Constructor Detail
-
Cached
public Cached(ComponentAdapter delegate)
-
Cached
public Cached(ComponentAdapter delegate, ObjectReference<Stored.Instance<T>> instanceReference)
-
-
Method Detail
-
getDescriptor
public java.lang.String getDescriptor()
Description copied from interface:ComponentAdapterGet a string key descriptor of the component adapter for use in toString()- Specified by:
getDescriptorin interfaceComponentAdapter<T>- Overrides:
getDescriptorin classStored<T>- Returns:
- the descriptor
-
-