public interface Injector
| Modifier and Type | Method and Description |
|---|---|
<T> T |
create(Class<? super T> cls) |
<T> T |
provide(Class<? super T> cls)
Synchronously returns a singleton which implements or extends this method's generic type.
|
<T> void |
setInstanceFactory(Class<T> cls,
javax.inject.Provider<T> provider) |
<T> void |
setSingletonFactory(Class<T> cls,
javax.inject.Provider<T> provider) |
<T> T provide(Class<? super T> cls)
SingletonDefault and SingletonOverride
For java mode, the JavaInjector uses runtime lookup of resources in
META-INF/singletons or META-INF/singletons to find bindings for your classes.
If you enable runtime injection, the tool will do a once-per-runtime scan for annotations,
and will generate the bindings in memory. For maximum performance in
production, you will want to use the preloading strategy to read in a
manifest of all injectable classes and prepare providers before they are
requested.
A maven plugin will be provided to create this manifest for you.
All libraries exporting functionality should include specific META-INF
bindings for defaults at least; the META-INF resources will only be checked
if the given type is not already bound.cls - - The service interface or base service class to provide<T> T create(Class<? super T> cls)
<T> void setSingletonFactory(Class<T> cls, javax.inject.Provider<T> provider)
<T> void setInstanceFactory(Class<T> cls, javax.inject.Provider<T> provider)
Copyright © December 07, 2012–2015 The Internet Party. All rights reserved.