Terra uses a simple annotation-based dependency injection framework to provide instances of important API objects to addons. The dependency injection framework reduces boilerplate by allowing addons to choose which objects they need to have access to.
Injecting to a Field¶
To inject to a field, simply make the field non-final and non-static, and annotate it Inject.
@Inject private Platform platform; @Inject private BaseAddon addon;
The Platform instance is injected into all addons. Bootstrap addons may inject additional types into addons they load. See the Dependency Injection in Entry Points section for information about injected types in Manifest Addons.