Package me.gilbva.shrike.context
Interface IocContextListener<T>
- Type Parameters:
T- Component class that you want listen.EXAMPLES
@Component class MyContextListener implement ContextListener<MyComponent> { public void preCreateComponent(Class<MyComponent>; component) { //only is call when MyComponent is pre create } public void preInitComponent(Class<MyComponent> component) { //only is call when MyComponent is pre init } public void postInitComponent(Class<MyComponent> component) { //only is call when MyComponent is post init } }If you want to listen to all components use Object
@Component class MyContextListener implement ContextListener<Object> { public void preCreateComponent(Class<Object> component) { //is call for each component pre create } public void preInitComponent(Class<Object> component) { //is call for each component pre init } public void postInitComponent(Class<Object> component) { //is call for each component post init } }
- All Known Subinterfaces:
Scope
- All Known Implementing Classes:
Application
public interface IocContextListener<T>
A listener for the
IocContext. This interfaz is mean to be
implemented in order for the container to call his methods upon the events
that take place on the IocContext
The context listener will be any component that implements the interface ContextListener, the framework must search all ContextListener implementations via the standard way of components resolution and call the 3 methods of the interface in the propper place.
- Author:
- Gilberto Vento
-
Method Summary
Modifier and Type Method Description voidpostInitComponent(java.lang.Class<T> clazz, T instance)Will be called after the components dependencies injection.voidpreCreateComponent(java.lang.Class<T> clazz)Will be called before a component is createdvoidpreInitComponent(java.lang.Class<T> clazz, T instance)Will be called after the component has been instantiate and before injecting the components dependencies
-
Method Details
-
preCreateComponent
Will be called before a component is created- Parameters:
clazz- The component class
-
preInitComponent
Will be called after the component has been instantiate and before injecting the components dependencies- Parameters:
clazz- The component classinstance- The component instance
-
postInitComponent
Will be called after the components dependencies injection.- Parameters:
clazz- The component classinstance- The component instance
-