Interface Injector
- All Known Implementing Classes:
InjectorImpl
public interface Injector
An interface for a dependency injector. For general information, see
README.md on GitHub.
-
Method Summary
Modifier and TypeMethodDescription<T> TgetComponent(Class<T> type) Returns a singleComponentof the specified type.<T,R> T getComponent(Class<T> type, Class<R> requesting) Returns a singleComponentof the specified type.<T> TgetComponent(TypeRef<T> type) Returns a singleComponentof the specified type.<T,R> T getComponent(TypeRef<T> type, TypeRef<R> requesting) Returns a singleComponentof the specified type.<T> List<T> getComponents(Class<T> type) ReturnsComponentsof the specified type.<T,R> List <T> getComponents(Class<T> type, Class<R> requesting) ReturnsComponentsof the specified type.<T> List<T> getComponents(TypeRef<T> type) ReturnsComponentsof the specified type.<T,R> List <T> getComponents(TypeRef<T> type, TypeRef<R> requesting) ReturnsComponentsof the specified type.<T> voidinvokeEvent(T event) Calls allEventHandlerswith the specified event that can accept its type as a parameter.voidinvokeEvents(Collection<?> events) Calls allEventHandlerswith the specified events that can accept their types as parameters.
-
Method Details
-
getComponent
Returns a singleComponentof the specified type. If theClasshas type parameters, usegetComponent(TypeRef)instead. Otherwise, an exception is thrown.- Type Parameters:
T- type of theComponentto be requested- Parameters:
type- type of theComponentto be requested- Returns:
Componentof the specified type- Throws:
ParameterCountMismatchException- if theClasshas type parameters
-
getComponent
Returns a singleComponentof the specified type. -
getComponent
Returns a singleComponentof the specified type. If the Component hasInstantiationPolicy.PER_INSTANCEand depends onInstantiationDetails, therequestingparameter will be used forInstantiationDetails. If theClasshas type parameters, usegetComponent(TypeRef)instead.- Type Parameters:
T- type of theComponentto be requestedR- type of the object requesting theComponent- Parameters:
type- type of theComponentto be requestedrequesting- type of the object requesting theComponent- Returns:
Componentof the specified type- Throws:
ParameterCountMismatchException- if the type or requestingClasshas type parameters
-
getComponent
Returns a singleComponentof the specified type. If the Component hasInstantiationPolicy.PER_INSTANCEand depends onInstantiationDetails, therequestingparameter will be used forInstantiationDetails. -
getComponents
ReturnsComponentsof the specified type. If theClasshas type parameters, usegetComponents(TypeRef)instead. Otherwise, an exception is thrown.- Type Parameters:
T- type of theComponentsto be requested- Parameters:
type- type of theComponentsto be requested- Returns:
ListofComponentsof the specified type- Throws:
ParameterCountMismatchException- if theClasshas type parameters
-
getComponents
ReturnsComponentsof the specified type.- Type Parameters:
T- type of theComponentsto be requested- Parameters:
type- type of theComponentsto be requested- Returns:
ListofComponentsof the specified type
-
getComponents
ReturnsComponentsof the specified type. If any of the Components haveInstantiationPolicy.PER_INSTANCEand depend onInstantiationDetails, therequestingparameter will be used forInstantiationDetails. If theClasshas type parameters, usegetComponent(TypeRef)instead. Otherwise, an exception is thrown.- Type Parameters:
T- type of theComponentsto be requestedR- type of the object requesting theComponents- Parameters:
type- type of theComponentsto be requestedrequesting- type of the object requesting theComponents- Returns:
ListofComponentsof the specified type- Throws:
ParameterCountMismatchException- if the type or requestingClasshas type parameters
-
getComponents
ReturnsComponentsof the specified type. If any of the Components havInstantiationPolicy.PER_INSTANCEand depend onInstantiationDetails, therequestingparameter will be used forInstantiationDetails.- Type Parameters:
T- type of theComponentsto be requestedR- type of the object requesting theComponents- Parameters:
type- type of theComponentsto be requestedrequesting- type of the object requesting theComponents- Returns:
ListofComponentsof the specified type
-
invokeEvent
<T> void invokeEvent(T event) Calls allEventHandlerswith the specified event that can accept its type as a parameter. If the event has type parameters, it must implementParametricEvent.- Type Parameters:
T- type of the event- Parameters:
event- event to be invoked
-
invokeEvents
Calls allEventHandlerswith the specified events that can accept their types as parameters. If an event has type parameters, it must implementParametricEvent.- Parameters:
events- events to be invoked
-