public class Stored<T> extends AbstractBehavior<T>
Modifier and Type | Class and Description |
---|---|
static class |
Stored.Instance<T> |
ComponentAdapter.NOTHING
delegate
Constructor and Description |
---|
Stored(ComponentAdapter<T> delegate,
ObjectReference<Stored.Instance<T>> reference) |
Modifier and Type | Method and Description |
---|---|
boolean |
componentHasLifecycle()
Invokes delegate hasLifecycle method if the delegate is a Behavior
Test if a component honors a lifecycle.
|
void |
dispose(PicoContainer container)
Disposes the cached component instance
Invokes delegate dispose method if the delegate is a Behavior
Invoke the "dispose" method on the component.
|
void |
flush()
Flushes the cache.
|
T |
getComponentInstance(PicoContainer container,
Type into)
Retrieve the component instance.
|
String |
getDescriptor()
Get a string key descriptor of the component adapter for use in toString()
|
protected String |
getLifecycleDescriptor() |
T |
getStoredObject()
Retrieves the stored reference.
|
boolean |
isStarted() |
void |
start(PicoContainer container)
Starts the cached component instance
Invokes delegate start method if the delegate is a Behavior
Invoke the "start" method on the component.
|
void |
stop(PicoContainer container)
Stops the cached component instance
Invokes delegate stop method if the delegate is a Behavior
Invoke the "stop" method on the component.
|
accept, changeMonitor, currentMonitor, dispose, findAdapterOfType, getComponentImplementation, getComponentInstance, getComponentKey, getDelegate, hasLifecycle, isLazy, start, stop, toString, verify
public Stored(ComponentAdapter<T> delegate, ObjectReference<Stored.Instance<T>> reference)
public boolean componentHasLifecycle()
AbstractBehavior
componentHasLifecycle
in interface ComponentLifecycle<T>
componentHasLifecycle
in class AbstractBehavior<T>
true
if the component has a lifecyclepublic void dispose(PicoContainer container)
dispose
in interface ComponentLifecycle<T>
dispose
in class AbstractBehavior<T>
container
- the container to "dispose" the componentpublic T getStoredObject()
public void flush()
public T getComponentInstance(PicoContainer container, Type into) throws PicoCompositionException
ComponentAdapter
Cached
will always return the
same instance.getComponentInstance
in interface ComponentAdapter<T>
getComponentInstance
in class AbstractBehavior<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.into
- the class that is about to be injected into. Use ComponentAdapter.NOTHING.class if this is not important to you.PicoCompositionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambiguous situation within the
container.public String getDescriptor()
ComponentAdapter
protected String getLifecycleDescriptor()
public void start(PicoContainer container)
start
in interface ComponentLifecycle<T>
start
in class AbstractBehavior<T>
container
- the container to "start" the componentpublic void stop(PicoContainer container)
stop
in interface ComponentLifecycle<T>
stop
in class AbstractBehavior<T>
container
- the container to "stop" the componentpublic boolean isStarted()
isStarted
in interface ComponentLifecycle<T>
isStarted
in class AbstractBehavior<T>
Copyright © 2003–2015 Codehaus. All rights reserved.