-
Notifications
You must be signed in to change notification settings - Fork 114
Injection default implementation
Starting from version 0.11, CachedInjector
is the default implementation of Injector
. It is used when no other instance is provided via WorldConfiguration.setInjector(). The CachedInjector
uses InjectionCache
to cache all relevant class and field-information, to improve injection-performance for repeated access.
To resolve the values used for field-injection, the CachedInjector
delegates to FieldHandler
. If FieldHandler
provides a non-null value for a field in a class eligible for injection (typically a class annotated with @Wire, then the value will be set for that field.
The InjectionCache
statically caches all relevant reflection-data needed to perform world-construction and object-injection, improving the performance of repeated calls to new World()
and World.inject()
. This provides significant reflection performance, especially on Android, where annotation-access is especially slow.
Note: Although the InjectionCache is instantiable, it is backed up by static field caches. Two instances of InjectionCache will use the same underlying data, so constructing new caches does not clear the cache. InjectionCache is not thread-safe.
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference