watson.di.processors¶
- class watson.di.processors.AttributeInjection[source]¶
Responsible for injecting required values into attributes.
Parameters: event (watson.events.types.Event) – The event dispatched from the container. Returns: The dependency Return type: mixed
- class watson.di.processors.Base[source]¶
The base processor that all other processors should extend.
When a processor is called from the container the following parameters are sent through with the event.
- definition: The dict definition of the dependency
- dependency: The name of the dependency
Depending on the event, a different target will also be sent with the event.
- watson.di.container.PRE_EVENT: The dict definition of the dependency
- watson.di.container.POST_EVENT: The initialized dependency
- class watson.di.processors.ConstructorInjection[source]¶
Responsible for initializing the dependency.
Responsible for initializing the dependency and injecting any required values into the constructor.
Parameters: event (watson.events.types.Event) – The event dispatched from the container. Returns: The dependency Return type: mixed
- class watson.di.processors.ContainerAware[source]¶
Injects the container into a dependency.
Responsible for injecting the container in any class that extends watson.di.ContainerAware. The container is then accessible via object.container
Parameters: event (watson.events.types.Event) – The event dispatched from the container. Returns: The dependency Return type: mixed
- class watson.di.processors.SetterInjection[source]¶
Responsible for injecting required values into setter methods.
Parameters: event (watson.events.types.Event) – The event dispatched from the container. Returns: The dependency Return type: mixed
- watson.di.processors.get_param_from_container(param, container)[source]¶
Internal function used by the container.
Retrieve a parameter from the container, and determine whether or not that parameter is an existing dependency.
Returns: The dependency (if param name is the same as a dependency), the param, or the value of the param. Return type: mixed