Context
Handles dependency injection mechanism. Allows binding selected classes with their providers.
Note that Context instances are not considered fully thread-safe - while it is usually safe to access a fully built context from within multiple threads, you should override createProvidersMap method and return a thread-safe MutableMap implementation to avoid concurrency bugs.
Functions
Automatically registers a provider for Type that will use reflection to create a new instance each time it is requested. All required constructor parameters will be extracted from Context. Note that the provider might throw InjectionException if any of the dependencies are missing, or com.badlogic.gdx.utils.reflect.ReflectionException when unable to construct an instance.
Allows to bind a provider producing instances of the selected type.
Allows to bind a provider to multiple classes in hierarchy of the provided instances class.
Automatically creates and registers an instance of Type with reflection. All required constructor parameters will be extracted from Context and must be present before calling this method.
Allows to bind a singleton to the chosen class.
Allows to bind a singleton instance to multiple classes in its hierarchy.
Allows to bind the result of the provider to multiple classes in its hierarchy.
Disposes of all Disposable singletons and providers registered in the context and removes them. Note that if registered provider provides Disposable instances, but it does not track the resources and does not implement Disposable itself, the provided assets will not be disposed by this method. Context does not track all injected assets: only directly registered objects are disposed. clear is called after all assets are disposed. Errors are caught and logged.
Extracts provider of instances of the selected type. This method is internally used by inlined injection methods.
Removes provider of instances of the selected type. This method is internally used by inlined removal methods.
Adds the selected provider to the Context. This method is internally used by inlined binding methods.