org.picocontainer.injectors
Class Reinjector

java.lang.Object
  extended by org.picocontainer.injectors.Reinjector

public class Reinjector
extends Object

A Reinjector allows methods on pre-instantiated classes to be invoked, with appropriately scoped parameters.


Constructor Summary
Reinjector(PicoContainer parentContainer)
          Make a reinjector with a parent container from which to pull components to be reinjected to.
Reinjector(PicoContainer parentContainer, ComponentMonitor monitor)
          Make a reinjector with a parent container from which to pull components to be reinjected to
 
Method Summary
 Object reinject(Class<?> key, Class<?> impl, InjectionFactory reinjectionFactory)
          Reinjecting into a method.
 Object reinject(Class<?> key, Class implementation, Object instance, InjectionFactory reinjectionFactory)
          Reinjecting into a method.
 Object reinject(Class<?> key, Class implementation, Object instance, Properties properties, InjectionFactory reinjectionFactory)
          Reinjecting into a method.
 Object reinject(Class<?> key, Enum reinjectionMethodEnum)
          Reinjecting into a method.
 Object reinject(Class<?> key, InjectionFactory reinjectionFactory)
          Reinjecting into a method.
 Object reinject(Class<?> key, Method reinjectionMethod)
          Reinjecting into a method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reinjector

public Reinjector(PicoContainer parentContainer)
Make a reinjector with a parent container from which to pull components to be reinjected to. With this constructor, a NullComponentMonitor is used.

Parameters:
parentContainer - the parent container

Reinjector

public Reinjector(PicoContainer parentContainer,
                  ComponentMonitor monitor)
Make a reinjector with a parent container from which to pull components to be reinjected to

Parameters:
parentContainer - the parent container
monitor - the monitor to use for 'instantiating' events
Method Detail

reinject

public Object reinject(Class<?> key,
                       Method reinjectionMethod)
Reinjecting into a method.

Parameters:
key - the component-key from the parent set of components to inject into
reinjectionMethod - the reflection method to use for injection.
Returns:
the result of the reinjection-method invocation.

reinject

public Object reinject(Class<?> key,
                       Enum reinjectionMethodEnum)
Reinjecting into a method.

Parameters:
key - the component-key from the parent set of components to inject into
reinjectionMethodEnum - the enum for the reflection method to use for injection.
Returns:
the result of the reinjection-method invocation.

reinject

public Object reinject(Class<?> key,
                       InjectionFactory reinjectionFactory)
Reinjecting into a method.

Parameters:
key - the component-key from the parent set of components to inject into (key and impl are the same)
reinjectionFactory - the InjectionFactory to use for reinjection.
Returns:
the result of the reinjection-method invocation.

reinject

public Object reinject(Class<?> key,
                       Class<?> impl,
                       InjectionFactory reinjectionFactory)
Reinjecting into a method.

Parameters:
key - the component-key from the parent set of components to inject into
impl - the implementation of the component that is going to result.
reinjectionFactory - the InjectionFactory to use for reinjection.
Returns:

reinject

public Object reinject(Class<?> key,
                       Class implementation,
                       Object instance,
                       InjectionFactory reinjectionFactory)
Reinjecting into a method.

Parameters:
key - the component-key from the parent set of components to inject into
implementation - the implementation of the component that is going to result.
instance - the object that has the provider method to be invoked
reinjectionFactory - the InjectionFactory to use for reinjection.
Returns:
the result of the reinjection-method invocation.

reinject

public Object reinject(Class<?> key,
                       Class implementation,
                       Object instance,
                       Properties properties,
                       InjectionFactory reinjectionFactory)
Reinjecting into a method.

Parameters:
key - the component-key from the parent set of components to inject into
implementation - the implementation of the component that is going to result.
instance - the object that has the provider method to be invoked
properties - for reinjection
reinjectionFactory - the InjectionFactory to use for reinjection.
Returns:
the result of the reinjection-method invocation.


Copyright © 2003-2010 Codehaus. All Rights Reserved.