|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.picocontainer.injectors.FactoryInjector<T>
public abstract class FactoryInjector<T>
An Injector which provides an custom instance in a factory style
Nested Class Summary | |
---|---|
static class |
FactoryInjector.CantWorkItOut
|
Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter |
---|
ComponentAdapter.NOTHING |
Constructor Summary | |
---|---|
FactoryInjector()
|
|
FactoryInjector(Class<T> key)
|
Method Summary | ||
---|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter. |
|
boolean |
componentHasLifecycle()
|
|
Object |
decorateComponentInstance(PicoContainer container,
Type into,
T instance)
A preexiting component instance can be injected into after instantiation |
|
void |
dispose(PicoContainer container)
|
|
|
findAdapterOfType(Class<U> adapterType)
Locates a component adapter of type componentAdapterType in the ComponentAdapter chain. |
|
static Class<?> |
getClass(Type type)
|
|
Class<T> |
getComponentImplementation()
Retrieve the class of the component. |
|
T |
getComponentInstance(PicoContainer container)
Retrieve the component instance. |
|
abstract T |
getComponentInstance(PicoContainer container,
Type into)
Retrieve the component instance. |
|
Object |
getComponentKey()
Retrieve the key associated with the component. |
|
ComponentAdapter<T> |
getDelegate()
Component adapters may be nested in a chain, and this method is used to grab the next ComponentAdapter in the chain. |
|
String |
getDescriptor()
Get a string key descriptor of the component adapter for use in toString() |
|
static
|
getTypeArguments(Class<FactoryInjector> class1,
Class<? extends Object> class2)
Get the actual type arguments a child class has used to extend a generic base class. |
|
void |
start(PicoContainer container)
|
|
void |
stop(PicoContainer container)
|
|
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisfied. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FactoryInjector() throws PicoCompositionException
PicoCompositionException
public FactoryInjector(Class<T> key)
Method Detail |
---|
public static Class<?> getClass(Type type)
public static <T> List<Class<?>> getTypeArguments(Class<FactoryInjector> class1, Class<? extends Object> class2)
class1
- the base classclass2
- the child class
public Object getComponentKey()
ComponentAdapter
getComponentKey
in interface ComponentAdapter<T>
public Class<T> getComponentImplementation()
ComponentAdapter
getComponentImplementation
in interface ComponentAdapter<T>
public void accept(PicoVisitor visitor)
ComponentAdapter
PicoContainer
, that
cascades the visitor also down to all its ComponentAdapter instances.
accept
in interface ComponentAdapter<T>
visitor
- the visitor.public ComponentAdapter<T> getDelegate()
ComponentAdapter
getDelegate
in interface ComponentAdapter<T>
public <U extends ComponentAdapter> U findAdapterOfType(Class<U> adapterType)
ComponentAdapter
findAdapterOfType
in interface ComponentAdapter<T>
U
- the type of ComponentAdapter being located.adapterType
- the class of the adapter type being located. Never null.
public T getComponentInstance(PicoContainer container)
ComponentAdapter
Cached
will always return the
same instance.
getComponentInstance
in interface ComponentAdapter<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.
public abstract T getComponentInstance(PicoContainer container, Type into)
ComponentAdapter
Cached
will always return the
same instance.
getComponentInstance
in interface ComponentAdapter<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.
public Object decorateComponentInstance(PicoContainer container, Type into, T instance)
Injector
decorateComponentInstance
in interface Injector<T>
container
- the container that can provide injectable dependenciesinstance
- the instance to
public void verify(PicoContainer container)
ComponentAdapter
verify
in interface ComponentAdapter<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.public String getDescriptor()
ComponentAdapter
getDescriptor
in interface ComponentAdapter<T>
public void start(PicoContainer container)
public void stop(PicoContainer container)
public void dispose(PicoContainer container)
public boolean componentHasLifecycle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |